can't save rgb->cmyk converted image files

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.
Post Reply
Fnorp
Posts: 1
Joined: 2012-06-28T03:12:49-07:00
Authentication code: 13

can't save rgb->cmyk converted image files

Post by Fnorp »

Hi.

I was looking for a way to convert images with PHP from RGB to CMYK. So I found ImageMagick, and first installed it locally on Xampp to test it, and it all worked well. Then I installed it on my server. There I got no error messages either.

The problem is as follows: when I want to save a file that I converted from RGB to CMYK, then that script crashes. I don't know why. The browser behaves then as if that php file of mine doesn't exist and can't be loaded, suggesting me to check my internet connection. Apart from the browser getting a load error, I see no error messages.

If I do not convert the image, but just save it, then it works. Or if I convert it but don't save it. But as soon as I try to save the converted image, the whole thing just bugs up and crashes. The file is written partially. Like, if I test it on a 120kb image, then the cmyk-file mightbe around 20kb. And when I try to open it, I get a decode error, telling me that the image contains no jpeg stream.

I'm not sure where the problem comes from. When installing the extension I got no errors of any kind, and the class is found too. If anyone could help me, that would be awesome. I need to get this to work for my job. :(

Here is the code I'm using to test the stuff:

Code: Select all

$image = new Imagick("inputRGB.jpg"); 
$image->setImageColorSpace(Imagick::COLORSPACE_CMYK);
$image->writeImage("outputCMYK.jpg");
The version I use on the sever is 6.7.1-7. The version I used locally with Xampp was 6.4.something (I had there problems with newer versions).

Edit: since I can't get any try/catch or similiar thingies to work, since, when saving or displaying a thus converted file the browser simply claims he can't load the script, I checked the PHP error logs. There this here is noted, whenever I try to do that: [notice] child pid 9465 exit Segmentation fault (11)
Post Reply