Hi,
I am using a web based digital resource package called Resource Space which allows you to up load images and then it uses ImageMagick to create the thumbnails, this worked fine on my testing server running
an up to date version but my host is running Version: ImageMagick 6.4.3 2008-08-28 Q16 http://www.imagemagick.org.
On my host the images end up with lots of vertical black lines when converting from cmyk to rgb.
is this a known problem? and how can i fix?
also my web host won't update their version. arrrrrgh
Cheers
Kevin
cmyk to rgb error
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: cmyk to rgb error
what is the command that does the conversion?
Does it use -colorspace RGB or does it use profiles?
see http://www.imagemagick.org/Usage/formats/#profiles
There could have been problems that were fixed. You can always check the changelog at http://www.imagemagick.org/script/changelog.php, but it is not necessarily complete.
Does it use -colorspace RGB or does it use profiles?
see http://www.imagemagick.org/Usage/formats/#profiles
There could have been problems that were fixed. You can always check the changelog at http://www.imagemagick.org/script/changelog.php, but it is not necessarily complete.
Re: cmyk to rgb error
I tested some of these older versions.. It seems to be a bug that occurred in "-colorspace RGB" in versions 6.4.3-5 and 6.4.3-6 and apparently was fixed right after that (though it's not in the changelog). Relly bad luck if you're stuck with IM version 6.4.3-6. 
I think, one can avoid these bad black bands (some images even get completely black due to that bug) in these old IM versions if one is using "-bordercolor white -border 1x1 -colorspace RGB -shave 1x1" instead of just "-colorspace RGB".
(With some CMYK images, it's even possible to avoid the problem with e.g. "-border 1x1 -shave 1x1 -colorspace RGB" - which is odd, as this shouldn't change the image for the conversion at all.)
Note that the conversion to RGB will be still.. far from perfect - especially in that old version. If you want to further improve the conversion, then you should use color profiles for that. (See the link above.) The conversion with color profiles is not affected by the bug.

I think, one can avoid these bad black bands (some images even get completely black due to that bug) in these old IM versions if one is using "-bordercolor white -border 1x1 -colorspace RGB -shave 1x1" instead of just "-colorspace RGB".
(With some CMYK images, it's even possible to avoid the problem with e.g. "-border 1x1 -shave 1x1 -colorspace RGB" - which is odd, as this shouldn't change the image for the conversion at all.)
Note that the conversion to RGB will be still.. far from perfect - especially in that old version. If you want to further improve the conversion, then you should use color profiles for that. (See the link above.) The conversion with color profiles is not affected by the bug.
Re: cmyk to rgb error
These are the lines for the conversion
Cheers
Kev
Code: Select all
# Preserve colour profiles? (omit for smaller sizes)
$profile="+profile \"*\" -colorspace RGB"; # By default, strip the colour profiles ('+' is remove the profile, confusingly)
if ($imagemagick_preserve_profiles && $id!="thm" && $id!="col" && $id!="pre" && $id!="scr") {$profile="";}
$runcommand = $command ." +matte $profile -resize " . $tw . "x" . $th . "\">\" ".escapeshellarg($path);
$output=shell_exec($runcommand);
# echo $runcommand."<br>";
# Add a watermarked image too?
global $watermark;
if (isset($watermark) && ($ps[$n]["internal"]==1 || $ps[$n]["allow_preview"]==1))
{
$path=get_resource_path($ref,true,$ps[$n]["id"],false,"",-1,1,true);
if (file_exists($path)) {unlink($path);}
$watermarkreal=dirname(__FILE__) ."/../" . $watermark;
$runcommand = $command ." +matte $profile -resize " . $tw . "x" . $th . "\">\" -tile ".escapeshellarg($watermarkreal)." -draw \"rectangle 0,0 $tw,$th\" ".escapeshellarg($path);
#die($runcommand);
$output=shell_exec($runcommand);
# echo $runcommand;
}
}
}
Kev
Re: cmyk to rgb error
Did you read the former reply?
You can either:
- update to a newer ImageMagick version
- or use color profiles (but your code would be more difficult then)
- or use e.g. "-bordercolor white -border 1x1 -colorspace RGB -shave 1x1" instead of "-colorspace RGB"
So, you could try to change the following line:into:
Then at least the very bad black lines should be gone.
You can either:
- update to a newer ImageMagick version
- or use color profiles (but your code would be more difficult then)
- or use e.g. "-bordercolor white -border 1x1 -colorspace RGB -shave 1x1" instead of "-colorspace RGB"
So, you could try to change the following line:
Code: Select all
$profile="+profile \"*\" -colorspace RGB";
Code: Select all
$profile="+profile \"*\" -bordercolor white -border 1x1 -colorspace RGB -shave 1x1";