MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
cranky
Post
by cranky » 2008-11-14T08:53:39-07:00
Someone pointed this out to me:
Generated from EPS:
Generated from a JPG (created by Illustrator):
The code I use for making the thumbnail from a EPS:
Code: Select all
$blob = file_get_contents("test.eps");
$magick_wand=NewMagickWand();
MagickReadImageBlob($magick_wand, $blob);
$wand = NewMagickWand();
MagickSetResolution( $wand, 300, 300 );
MagickReadImageBlob($wand, $blob);
$new_wand = MagickTransformImage($wand, NULL, '50x');
MagickSetImageFormat($new_wand, 'jpg') ;
MagickWriteImage($new_wand, "file.jpg");
DestroyMagickWand($new_wand);
DestroyMagickWand($wand);
Any ideas why there is the color difference between the two methods? I assume the JPG version is the "correct" one. Any insight would be much appreciated!
magick
Site Admin
Posts: 11064 Joined: 2003-05-31T11:32:55-07:00
Post
by magick » 2008-11-14T10:37:52-07:00
The original images are in the CMYK colorspace. To properly convert to RGB try first
convert -colorspace rgb image.eps -quality 92 image.jpg
If that does not produce a satisfactory result, use color profiles (i.e. the -profile option with two profiles, one SWOP and one sRGB).
cranky
Post
by cranky » 2008-12-22T15:14:34-07:00
To update this thread - I am trying to add ICC profiles so that CMYK keep their proper colors. I found some resources online, but can not seem to get it to apply the profiles properly. Here is what I have - any ideas on why the profiles are not showing up properly? Thanks!!
Code: Select all
$wand = NewMagickWand();
MagickSetResolution( $wand, 300, 300 );
MagickReadImage($wand, "$original_file.eps");
if( MagickGetImageColorspace( $wand ) == MW_CMYKColorspace ) {
MagickRemoveImageProfile( $wand, "ICC" );
MagickSetImageProfile( $wand, 'ICC', file_get_contents( 'USWebCoatedSWOP.icc' ) );
MagickProfileImage($wand, 'ICC', file_get_contents( 'sRGB.icm' ) );
MagickSetImageColorspace( $wand, MW_RGBColorspace );
}
$new_wand = MagickTransformImage($wand, NULL, '50x');
MagickSetImageFormat($new_wand, 'jpg') ;
MagickStripImage($new_wand);
MagickWriteImage($new_wand, "final_image.jpg");
DestroyMagickWand($new_wand);
DestroyMagickWand($wand);
The goal is to make
(created by ImageMagick from EPS) look like
(created by Photoshop). The original EPS is CMYK.
Users browsing this forum: No registered users and 12 guests