PNG resising file size problem

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
gse-media

PNG resising file size problem

Post by gse-media »

Hello,

I did search the forum but did not find a solution to this, or overlooked it. I am resisizing some PNG images and getting obscene file sizes for some of the output (smaller resolution) images. The command I'm using is:

convert > [original file] -resize '400' -strip -quality 90 -unsharp 4.5x.5 [output file]

An example of results:

Original file: 582 x 800 : 58.6KB : 1027 colors

Resize 1: 400 x 550 : 304KB : 3161 colors
Resize 2: 73 x 100 : 31KB : 550 colors

Any help would be appreciated. This is killing me!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PNG resising file size problem

Post by snibgo »

It would help us if you posted the images (put them on the web somewhere and tell us the URLs).

I would expect sharpening to increase the sizes.
snibgo's IM pages: im.snibgo.com
gse-media

Re: PNG resising file size problem

Post by gse-media »

Sure thing:

Original: http://www.freestockphotos.biz/download ... /11440.png

Resize 1: http://www.freestockphotos.biz/pictures ... 40/egg.png (slightly smaller dimensions, much higher file size)
Resize 2: http://www.freestockphotos.biz/thumbs_0 ... _11440.png (much smaller dimensions, somewhat smaller, but still larger than expected file size)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PNG resising file size problem

Post by fmw42 »

IM does not necessarily make optimized size pngs. Also be sure you are using -quality correctly. see http://www.imagemagick.org/Usage/formats/#png_quality and http://www.imagemagick.org/Usage/formats/#png_non-im
gse-media

Re: PNG resising file size problem

Post by gse-media »

Thanks fmw42,

I did read up on the -quality for pngs after I originally posted, and did quite a few tests without any significant results. I will look at some of the other optimizer possibilities, but not sure if they'll be available for me to use.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PNG resising file size problem

Post by snibgo »

What version IM do you use, on what platform? Your commands on IM 6.6.0-8 Q16 Windows 7 gives egg.png as 69785 bytes. Partly because it outputs 8-bit channels, not 16-bit.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PNG resising file size problem

Post by fmw42 »

If on Q16, add -depth 8 to generate 8 bits per channel rather than 16 bits per channel. Also see PNG8: vs PNG32: and PNG24 http://www.imagemagick.org/Usage/formats/#png_formats and png controls at http://www.imagemagick.org/Usage/formats/#png_write
gse-media

Re: PNG resising file size problem

Post by gse-media »

It looks like I am using version: 6.3.9 12/10/08 Q16

I will have to talk to my web host to see about updating the version.

I will try -depth and do the reading up. Thank you for your help so far, I appreciate it!
Post Reply