IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
I am no expert on Imagick, but it looks to me like you have some of the commands backwards.
1) put your matte command before colorspace to emulate the command line
2) +matte disables the matte channel, (-matte enables it). however, in IMagick you are enabling it with "true"
3) -negate reverses the grayscale, but in Imagick you have $img->negateImage(false); which I would take to mean disable or not negate
I've been trying to replicate that command using C and MagickWand (I don't use IMagick) but I'm also not having any luck.
I've attached an edited version of my code . The image produced immediately after the Negate is the same as that of the command line version but the result of the FX is not even close.
mw = NewMagickWand();
MagickReadImage(mw,"eyes.gif");
// +matte
MagickSetImageAlphaChannel(mw,DeactivateAlphaChannel);
// -colorspace Gray
// NOTE setImageColorspace doesn't seem to do anything
// so use these two functions instead
MagickSetImageType(mw, GrayscaleType);
MagickQuantizeImage(mw, 16, GRAYColorspace, 0 , 0, 0);
// -scale 1600%
w = (int)MagickGetImageWidth(mw);
h = (int)MagickGetImageHeight(mw);
MagickScaleImage(mw,w*16,h*16);
// -negate
MagickNegateImage(mw,MagickFalse);
MagickReadImage(mw,"dpat_symbols.gif");
// -virtual-pixel tile
MagickSetImageVirtualPixelMethod(mw,TileVirtualPixelMethod);
// -fx 'u[floor(16*u)+1]'
mwfx = MagickFxImage(mw,"u[floor(16*u)+1]");
/* Write the image */
MagickWriteImage(mwfx,"eyes_syms.gif");
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
@resoai: Which version of IM are you using and is it configured for HDRI?
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
See the reply from Magick in viewtopic.php?f=3&t=16925.
You have to set the virtual pixel method in every image.
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Thanks Magick. That fixed up the first example.
But the second example didn't use virtual pixel method. I tried it anyway but it didn't make any difference. The colours are still in the wrong order compared to the command line.
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
WARNING: that copy of IM Examples, has not been updated in a very long time.
The version number at the bottom of the page is IM 6.2.9 and dated from 2006!
however the dithering example has not changed so should work as expected.
Nice to see someone making use of that technique.