in reply to Reading an image palette

See IM examples..quantize and Perl-Magick for the Perl translations.
use Image::Magick; my $img = Image::Magick->new; $img->Read('./img.jpg' ); #before $img->Identify(); $img->Quantize( colors => 18 ); $img->Set( type => 'Palette' ); #after $img->Identify();

I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: Reading an image palette
by leocharre (Priest) on Sep 28, 2008 at 01:04 UTC
    Hmm.. Yeah.. I'm not getting a return value on Identify().. At all.
      What do you want returned? Identify prints it's output to the terminal. If you want to capture the output for regexing, run the c command thru backticks or a piped open.
      #my $return = `identify -verbose $file`; #print $return; my $pid = open(my $fh,"identify -verbose $file |"); while(<$fh>){print }

      I'm not really a human, but I play one on earth Remember How Lucky You Are

        I thought my post made it very clear that's just what I was already doing- Looking back at it, I made a poor job of stating that.

        zentara, you must see my confusion with the fact that Identify() method specifically outputs to (STDERR? Or tty?). I guess this would be the most 'funny' thing I've ever seen Image::Magick do. That's saying a lot.

        I mean, really? Method Identify().. so that it may output to the tty (must be STDERR) exactly what cli identify would do? Really? Let's just put in a method called 'Trasparentize' that prints empty strings to "QWERTY"..

        Thanks for the piped open example.