leocharre has asked for the wisdom of the Perl Monks concerning the following question:
I want to take an image, limit the colors, and then find out what they are.
use Image::Magick; my $img = Image::Magick->new; $img->Read('./img.jpg' ); $img->Quantize( colors => 18 ); $img->Set( type => 'Palette' ); $img->Write('./out.png'); # I can check that it has been reduced... my $out = Image::Magick->new; $out->Read('./out.png'); $out->Get( colors ) == 18 or die;
How do I get what the colors actually are? In hex, rgb, anything will do..
Like the output of identify -verbose would do?
I want an array or some other structure that holds the colors. Right now I'm making a call to cli 'identify' but it's demeaning.
I'm willing to use something other than IM
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading an image palette
by BrowserUk (Patriarch) on Sep 26, 2008 at 21:48 UTC | |
by leocharre (Priest) on Oct 03, 2008 at 15:49 UTC | |
|
Re: Reading an image palette
by tod222 (Pilgrim) on Sep 26, 2008 at 21:02 UTC | |
|
Re: Reading an image palette
by zentara (Cardinal) on Sep 27, 2008 at 15:04 UTC | |
by leocharre (Priest) on Sep 28, 2008 at 01:04 UTC | |
by zentara (Cardinal) on Sep 28, 2008 at 13:04 UTC | |
by leocharre (Priest) on Oct 03, 2008 at 15:40 UTC | |
|
Re: Reading an image palette
by zentara (Cardinal) on Oct 05, 2008 at 19:24 UTC | |
by zentara (Cardinal) on Oct 06, 2008 at 13:27 UTC |