convert blows up png on resize

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
warb

convert blows up png on resize

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert blows up png on resize

Post 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.
warb

Re: convert blows up png on resize

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert blows up png on resize

Post 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.
warb

Re: convert blows up png on resize

Post by warb »

Ok I'll try that. If this is a common occurrence you might think about adding to FAQ.

Thanks.
Post Reply