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 » 2007-02-06T19:26:58-07:00

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: 11015
Joined: 2003-05-31T11:32:55-07:00

Re: convert blows up png on resize

Post by magick » 2007-02-06T20:42:40-07:00

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 » 2007-02-08T21:05:01-07:00

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: 11015
Joined: 2003-05-31T11:32:55-07:00

Re: convert blows up png on resize

Post by magick » 2007-02-08T21:42:48-07:00

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 » 2007-02-12T10:22:28-07:00

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

Thanks.

Post Reply