Convert image change colorspace

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
MisterJpa
Posts: 9
Joined: 2018-07-23T02:32:48-07:00
Authentication code: 1152

Convert image change colorspace

Post by MisterJpa » 2019-01-14T09:40:35-07:00

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

snibgo
Posts: 11100
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert image change colorspace

Post by snibgo » 2019-01-14T09:56:02-07:00

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.
snibgo's IM pages: im.snibgo.com

MisterJpa
Posts: 9
Joined: 2018-07-23T02:32:48-07:00
Authentication code: 1152

Re: Convert image change colorspace

Post by MisterJpa » 2019-01-15T03:23:53-07:00

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

snibgo
Posts: 11100
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert image change colorspace

Post by snibgo » 2019-01-15T07:14:00-07:00

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".
snibgo's IM pages: im.snibgo.com

Post Reply