PNG Performance

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
kilrae

PNG Performance

Post by kilrae »

I have a 700k 1280x800 PNG that I am resizing (testing) to 500x312.

I have tried scaleImage, resizeImage, thumbnailImage and sampleImage. I have tried setImageFormat('png') and setCompressionQuality(0) and (100).

The file is scaled, but the filesize remains around 6-700k (although one method I tried caused it to jump to over 900k).

I tested in GD and the resulting file was around 100k. JPEGs work fine, it's only PNG I'm having trouble with. Is there anything different I need to do to handle PNGs?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PNG Performance

Post by magick »

Set the image depth to 8. By default it is most likely creating a 16-bit PNG image.
kilrae

Re: PNG Performance

Post by kilrae »

Ahh, beautiful. 150k.

It seems odd to me that thumbnails would default to being created at a higher depth than the original image (getImageDepth tells me the original was 8bit).
Post Reply