Page 1 of 1

Color Difference Between JPG and EPS rendered.

Posted: 2008-11-14T08:53:39-07:00
by cranky
Someone pointed this out to me:

Generated from EPS:
Image Image

Generated from a JPG (created by Illustrator):
Image Image

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!

Re: Color Difference Between JPG and EPS rendered.

Posted: 2008-11-14T10:37:52-07:00
by magick
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).

Re: Color Difference Between JPG and EPS rendered.

Posted: 2008-12-22T15:14:34-07:00
by cranky
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 Image (created by ImageMagick from EPS) look like Image (created by Photoshop). The original EPS is CMYK.