Page 1 of 1

Convert image change colorspace

Posted: 2019-01-14T09:40:35-07:00
by MisterJpa
Hello,

Here is my image magick version :

Code: Select all

Version: ImageMagick 7.0.8-21 Q16 x86_64 2018-12-28 https://imagemagick.org
I'm facing an issue trying to convert an image which is having the CMYK Colorspace.
I'm converting it to png using this command :

Code: Select all

convert -define jpeg:size=image.tif[0] -thumbnail 140x100 rendition.140.100.png
Unfortunately, using identify -verbose on the generated PNG, I found out that the Colorspace change to sRGB.
Is there any issue with my command ? Any precision I can provide to the command to tell him to keep using the same colorspace?

If needed, you can get the image from here : https://www.dropbox.com/s/m7d8r8oo920ru ... e.tif?dl=0

Many thanks by advance,
MisterJpa

Re: Convert image change colorspace

Posted: 2019-01-14T09:56:02-07:00
by snibgo
Your command is very strange, and invalid, and IM can't process it.

Your input is CMYK. PNG can't record CMYK images, so IM converts it to sRGB. If you want to keep it as CMYK, use a different format, such as TIFF.

Re: Convert image change colorspace

Posted: 2019-01-15T03:23:53-07:00
by MisterJpa
Hello,

Thanks for your answer Snigbo.
I don't why but I was not able to find this information yesterday on google.

I don't understand for the first part of your answer why it is invalid (I'm sure it's very strange, I'm not really use to image magick :) ) but I can tell you that IM is processing all my customer images using the 140.100 parameter :)

Could you suggest an improvment of my command (forgetting the part talking about CMYK colorspace) ?

Thanks
MisterJpa

Re: Convert image change colorspace

Posted: 2019-01-15T07:14:00-07:00
by snibgo
The "convert" command needs an input file. The command you posted doesn't have one, so it cannot work. Your command has:

Code: Select all

-define jpeg:size=image.tif[0]
But the documentation http://www.imagemagick.org/script/comma ... php#define says "-define jpeg:size=" needs a pair of numbers like 128x128, not a filename, so I would expect something like this:

Code: Select all

convert -define jpeg:size=128x128 image.tif[0] -thumbnail 140x100 rendition.140.100.png
But your input is TIFF, not JPEG, so "-define jpeg:size=WxH" will have no effect, and can be removed.

You are running IM v7. I suggest you use "magick", not "convert" or "magick convert".