What diff for grayscale transbetween perlmagic & magic++
What diff for grayscale transbetween perlmagic & magic++
Hi,
Recently I found when I was using perlmagick transform a pic to grayscale using
$image->[$i]->Quantize(colorspace=>'gray');
produces different effect from Magick++ by using
mImage.quantizeColorSpace(GRAYColorspace);
mImage.quantizeColors(256);
mImage.quantize();
although I try to change the # of colors, it seems still quite different. I prefer the perl version alg, is there anyone know what is the difference? And what could I do to make it produce the same thing?
thanks a lot
Stan
Recently I found when I was using perlmagick transform a pic to grayscale using
$image->[$i]->Quantize(colorspace=>'gray');
produces different effect from Magick++ by using
mImage.quantizeColorSpace(GRAYColorspace);
mImage.quantizeColors(256);
mImage.quantize();
although I try to change the # of colors, it seems still quite different. I prefer the perl version alg, is there anyone know what is the difference? And what could I do to make it produce the same thing?
thanks a lot
Stan
PerlMagick and Magick++ produce the same grayscale image for us. We're running ImageMagick 6.3.1-4. Our PerlMagick code is: Our Magick++ code is: When we run the compare command it returns 0 meaning the images are exactly the same:
Code: Select all
use Image::Magick;
$image=Image::Magick->new();
$image->Read('logo.png');
$image->Quantize(colorspace=>'gray');
$image->Write('perl.miff');
Code: Select all
#include <Magick++.h>
#include <iostream>
#include <string>
using namespace std;
using namespace Magick;
int main(int argc, char** argv)
{
try
{
Image mImage;
mImage.read("logo.png");
mImage.quantizeColorSpace(GRAYColorspace);
mImage.quantizeColors(256);
mImage.quantize();
mImage.write("magick++.miff");
}
catch (Magick::Exception& err)
{
fprintf(stderr, "Exception:%s",err.what());
}
}
- compare -metric mse perl.miff magick++.miff null:
0
Hi,
You are right, it is the same! I made a mistake by saving in gif which should be jpg. Sorry for the trouble! And another question is in perl magick there is a method called blackthreshold and whitethreshold, and in magick++ it seems gone, so is there any combination of APIs to achieve the same effect?
thanks
Stan
You are right, it is the same! I made a mistake by saving in gif which should be jpg. Sorry for the trouble! And another question is in perl magick there is a method called blackthreshold and whitethreshold, and in magick++ it seems gone, so is there any combination of APIs to achieve the same effect?
thanks
Stan