PHP CMYK to sRGB - JPG Images not keeping true colors

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.
User avatar
fmw42
Posts: 25046
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PHP CMYK to sRGB - JPG Images not keeping true colors

Post by fmw42 » 2015-07-06T18:33:21-07:00

Unfortunately, I do not know Homebrew, so I probably cannot help much more.

gweiss27
Posts: 12
Joined: 2015-07-06T13:46:15-07:00
Authentication code: 1151

Re: PHP CMYK to sRGB - JPG Images not keeping true colors

Post by gweiss27 » 2015-07-06T19:56:48-07:00

So I followed all your advice (tho I don't know how to do manual builds of mac/linux programs). I followed your instructions, and got imagemagick installed. I can see the lcms and other things are showing up. Following the command line options and using color profiles, I was able to get this to FINALLY WORK.

I went back and tried to get imagick for php reinstalled, thinking it is an API and maybe the updated imagemagick would work but its clear that didnt do the job.

I figured out how to write PHP to call the exec of the command line code I need to run and got that to work. So I guess I can just use the EXEC command and pass parameters to construct my $cmd statement as I require.

I guess this will work great. I can do what I need to do, although it bothers me a little I couldn't get the other way to work. It seems strange there would be such a big hole in image generation between imagemagick and imagick but maybe I am just naive.

Thanks so much for your quick responses and working through this with me.

Appreciate all your help!

G

User avatar
fmw42
Posts: 25046
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PHP CMYK to sRGB - JPG Images not keeping true colors

Post by fmw42 » 2015-07-06T20:57:25-07:00

Glad you got that working. I am not expert at Imagick and do not use it, so sorry I could not be of much help there.

User avatar
fmw42
Posts: 25046
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PHP CMYK to sRGB - JPG Images not keeping true colors

Post by fmw42 » 2015-07-06T21:19:36-07:00

First you only seem to have one input image, so if it is not a multilayer image such as tif or gif or pdf, then numbering the output makes no sense. If it is a tif or gif or pdf, then try a simple command line with specific values. Also you need to put the input image first after convert for proper IM syntax, except if it is a PDF. Then the image comes right after setting the density, since PDF is a vector format.

It looks like the quotes are making '%+02d' as literal. Also leave off the +.

Try something like the following to be sure it works.

Code: Select all

exec("/usr/local/bin/convert -density 72 input.pdf -profile USWebCoatedSWOP.icc -profile sRGB_v4_ICC_preference.icc -trim +repage -resize x1732 -quality 92 output_%02d.jpg")
Change the density and quality as you desire. If that works, then put in your variables.

In the future, please start a new thread/topic rather than changing the subject matter in an existing post.

gweiss27
Posts: 12
Joined: 2015-07-06T13:46:15-07:00
Authentication code: 1151

Re: PHP CMYK to sRGB - JPG Images not keeping true colors

Post by gweiss27 » 2015-07-06T21:25:43-07:00

Ok, that completely worked. I thought I had tried that but I guess I didn't.

Yes, I am converting PDF files so that's why I'm using the numbering and I wanted them to all be 2 digits. This is perfect.

The -scene works but yours works as well.

Again, many MANY thanks! :)

Post Reply