Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Reduce colors with Image::Magick

Reply
Thread Tools

Reduce colors with Image::Magick

 
 
yong321@yahoo.com
Guest
Posts: n/a
 
      07-01-2007
I use this code to test reducing number of image colors (image from
http://www.libpng.org/pub/png/).

use Image::Magick;
$p = new Image::Magick;
$p->Read("pnglogo-blk-sml1.png");
$p->Quantize(colors=>64);
#$p->Posterize(levels=>1, dither=>True);
$p->Write("pnglogo-blk-sml12.png");

I use IrfanView to check number of colors (should be the same as
Get(colors) of Image::Magick). Number of *unique* colors has indeed
decreased from 256 to 64. But both Original Colors and Current Colors
reported by IrfanView are still "256 (8 BitsPerPixel)". Since I only
have 64 colors, how can I reduce bits per pixel to 6?

The real goal is to reduce file size by sacrificing some colors. Size
of original image pnglogo-blk-sml1.png is 17260. New image pnglogo-blk-
sml12.png is 11049. Can this be reduced further?

Yong Huang

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any library that can convert RGB colors to ANSI colors? ZelluX Python 3 12-01-2008 11:08 AM
TreeNode colors come from anchor colors AAaron123 ASP .Net 1 08-07-2008 07:56 PM
Does bridging reduce overall speed? Gregg Hill Wireless Networking 1 04-24-2005 07:36 PM
better to compress the jpeg or reduce resolution or reduce pixel size? Mr.Will Digital Photography 8 10-08-2004 03:16 PM
Re: running IE is bad? was: Intel may have to reduce speed of Prescott willbill Firefox 2 12-26-2003 06:51 PM



Advertisments