Page 1 of 1

convert blows up png on resize

Posted: 2007-02-06T19:26:58-07:00
by warb
I wrote a little python script to resize a bunch of png's and the
file size grew from 4.4meg to 38megs! Dimensions were cut in half.

here is a fragment:

cmd = "convert " +path +" -resize 50% " +newpath
print "cmd=" +cmd
os.system(cmd)

Any clues? Also, memory usage grew to 1.6gig during the conversion.

Using windows 6.3.2-Q16

Thanks.

Re: convert blows up png on resize

Posted: 2007-02-06T20:42:40-07:00
by magick
Before we can comment, we need to reproduce the problem. Post a URL to one of your PNG images so we can download. We'll let you know if we can the same results.

Re: convert blows up png on resize

Posted: 2007-02-08T21:05:01-07:00
by warb
Ok,
here is a sample: http://www.andy-lamb.com/danny/12205_10.PNG (original file from BSB2PNG)
output from convert http://www.andy-lamb.com/danny/12205_10_50.PNG (ten times the size)

These are NOAA marine raster charts.

Re: convert blows up png on resize

Posted: 2007-02-08T21:42:48-07:00
by magick
The resize option introduces new colors which reduces opportunities for compression. Use -sample 50% and you will get a reasonably compressed PNG image.

Re: convert blows up png on resize

Posted: 2007-02-12T10:22:28-07:00
by warb
Ok I'll try that. If this is a common occurrence you might think about adding to FAQ.

Thanks.