How to do redusing color and alpha for PNG RGBA32bit to RGBA

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
yush125
Posts: 4
Joined: 2013-05-02T04:21:49-07:00
Authentication code: 6789

How to do redusing color and alpha for PNG RGBA32bit to RGBA

Post by yush125 »

Here is document and sample about redusing color RGBA32bit color to RGBA8bit with high quality.
http://www.webtech.co.jp/imesta/psp/f_alpha_blend.html

Here is sample picture.
Image

And this is my command and result picture "orijinal_after.png"

Code: Select all

convert "orijinal.png" -ordered-dither o8x8,8,8,8 "orijinal_after.png"
Result of 32bit to 8bit color with using IM.
Image
It has bit more noisy than Optpix imesta's one.

If you know more better option , tell me about that.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to do redusing color and alpha for PNG RGBA32bit to

Post by fmw42 »

You are dithering which will add the dither pattern. I suspect that is not what you want to do.

try

convert image.png PNG8:result.png
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: How to do redusing color and alpha for PNG RGBA32bit to

Post by glennrp »

fmw42 wrote:You are dithering which will add the dither pattern. I suspect that is not what you want to do.

try

convert image.png PNG8:result.png
PNG8 does quick-and-dirty color reduction and will produce severe banding.

Code: Select all

convert image.png -colors 255 result.png
will do better. Or, if you want a 1-bit alpha channel, use png8: after reducing
the colors:

Code: Select all

convert image.png -colors 255 png8:result.png
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to do redusing color and alpha for PNG RGBA32bit to

Post by anthony »

The ordered dither only provides a uniform colormap. As a consequence no all colors in that map is being used for that image.

You can increase the color counts until you get about 255 colors in the reulting image.
An example of doing this is in Video to GIF animation
http://www.imagemagick.org/Usage/video/#gif

Look for "Higher Quality Ordered Dithered Video"
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
yush125
Posts: 4
Joined: 2013-05-02T04:21:49-07:00
Authentication code: 6789

Re: How to do redusing color and alpha for PNG RGBA32bit to

Post by yush125 »

Hi,everyone.

fmw42,glennrp,anthony Thank you for answering.

That's a very helpful for me.

And I did as following your advice.
Here is result.It's quite better than my first.Almost I satisfied with that.
Image


Thank you very much.

yush125
Post Reply