optimize PNG Image for Web Sites

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
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

optimize PNG Image for Web Sites

Post by linjuming »

i use the png files for css backgrounds.
i use the faststone phpoto resizer which can optimize a png file from 2M to 465k . the optimized png looks the same as the old one.
can IM do it ? no lossing optimizing ?
can you good guys print out your IM code for png optimizing ? primarily for css background.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: optimize PNG Image for Web Sites

Post by anthony »

IM saves PNG images, bt does nto do a lot of optimizing. It will for example switch between Indexed, 24bit and 32 bit PNG images.

If you want PNG optimization I suggest you use an proper PNG optimizer
http://www.imagemagick.org/Usage/formats/#png_non-im
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: optimize PNG Image for Web Sites

Post by linjuming »

Thanks,best wish
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: optimize PNG Image for Web Sites

Post by glennrp »

You can try writing to the PNG8 (PNG sub-format).

With IM-6.6.7-10, this will reduce the colors to less than 256
if necessary, using a quick-and-dirty reduction to a 3-3-2
pallette. This is of course a lossy operation.

With earlier versions this probably won't work.

If you don't like that result you will have to use the "-colors 255"
option (for better color quantization) before writing the image.

../glennrp
Post Reply