PHP MagickWand True Grayscale
Im looking for a way to replicate the Photoshop Grayscale/Desaturate feature in PHP, I have MagickWand installed on the server.
I have tried numerous different methods (including iterating the pixels) but the contrast is always altered (brighter) when I open the modified image in photoshop.
开发者_JAVA技巧I'm thinking it might have something to do with the embedded color profile not being saved??
$resource = NewMagickWand();
MagickReadImage( $resource, $file);
MagickQuantizeImage( $resource, 16772216, MW_GRAYColorspace, 8, true, true );
header( 'Content-Type: image/jpeg' );
MagickEchoImageBlob( $resource );
Anyone know of a true grayscale that can be done via PHP?? Solution doesn't have to use Imagemagick
Appreciated
convert an image to greyscale with imagemagick
$resource = NewMagickWand();
MagickReadImage( $resource, $file);
$colors = MagickGetImageColors( $resource );
MagickQuantizeImage( $resource, $colors, MW_GRAYColorspace, 8, true, true );
MagickGetImageProfile( $resource , 'ICC');
//MagickModulateImage( $resource, 90, 0, 0);
//MagickContrastImage( $resource, 2 );
MagickProfileImage( $resource, '*' , 'NULL');
MagickProfileImage( $resource, 'ICC' , file_get_contents('ICC/sGray.icc'));
header( 'Content-Type: image/jpeg' );
MagickEchoImageBlob( $resource );
Heres a link to the gray profile http://www.mediafire.com/?jxlwfyjzjzj
精彩评论