how to automatic reduce png colors?

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
fuchaoqun
Posts: 6
Joined: 2011-01-03T04:59:31-07:00
Authentication code: 8675308

how to automatic reduce png colors?

Post by fuchaoqun »

Dears,

I have a png file here:

http://img.hixue.com/test/p1.png

It's so big, I use fireworks to rebuild its color table, and it got much smaller, how can I use imagemagick to reduce the image file size? It seems that the file only have some unique colors, less than 256.

Thanks very much.
fuchaoqun
Posts: 6
Joined: 2011-01-03T04:59:31-07:00
Authentication code: 8675308

Re: how to automatic reduce png colors?

Post by fuchaoqun »

the optimized png file is here: http://img.hixue.com/test/p11.png

how can i use imagemagick to do it?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to automatic reduce png colors?

Post by fmw42 »

fuchaoqun
Posts: 6
Joined: 2011-01-03T04:59:31-07:00
Authentication code: 8675308

Re: how to automatic reduce png colors?

Post by fuchaoqun »

Dear fmw42,

I have tried those tools, but I can not work it out? can you give me a command that I can convert p1.png to the size of p11.png without lose much quality

there are many gray and truecolor images, so I can not just set them gray.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to automatic reduce png colors?

Post by fmw42 »

sorry I am not an expert on optimizing png. I have been told that optipng is one of the better tools.
fuchaoqun
Posts: 6
Joined: 2011-01-03T04:59:31-07:00
Authentication code: 8675308

Re: how to automatic reduce png colors?

Post by fuchaoqun »

thanks, can somebody help me to fix it?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to automatic reduce png colors?

Post by fmw42 »

you can convert to png or gif with reduced number of colors and get about the same filesize as your optimized png


convert p1.png -colors 16 p1_c16.gif

convert p1.png -colors 16 p1_c16.png
fuchaoqun
Posts: 6
Joined: 2011-01-03T04:59:31-07:00
Authentication code: 8675308

Re: how to automatic reduce png colors?

Post by fuchaoqun »

there are turecolor and gray images, I can not just set the same color numbers.
Post Reply