Page 1 of 1
Getting colorspace using identify
Posted: 2006-10-10T07:41:37-07:00
by martinw17
I am trying to find out the colorspace of an image using a command-line call.
identify -format %r myimage.jpg
gives me the colorspace, but this is concatenated onto the end of the image class (with no space).
Is it possible to get the colorspace without the image class?
If not, what are the possible values for image class? Is this the complete set:
DirectClass
PseudoClass?
(Knowing that enables me to parse the output to obtain the colorspace).
Thanks,
Martin
Posted: 2006-10-10T08:02:26-07:00
by magick
The image class is one of DirectClass or PseudoClass. To get just the colorspace you need the
-verbose option of the
identify command:
- idenitfy -verbose myimage.jpg
Posted: 2006-10-10T08:06:13-07:00
by martinw17
I am trying to get the colorspace without having to parse the results of identify -verbose.
If the image class will only ever be one of DirectClass or PseudoClass then that helps, as I can use -format %r.
Thanks for your help.
Regards,
Martin
why ?
Posted: 2006-12-01T14:21:43-07:00
by uprocka
I have the same problem:
identify -format %r produces the following output:
DirectClassCMYK
That makes no sense if I just want to know the Colorspace...
Why is there no % command to get the return value: e.g. CMYK
no I have to parse the returnvalue...
Re: Getting colorspace using identify
Posted: 2012-04-12T23:02:02-07:00
by DemonDVA
Re: Getting colorspace using identify
Posted: 2012-04-13T00:22:50-07:00
by anthony
Actually I'd look at %[channels] too these are a little mixed up in IMv6.
Re: Getting colorspace using identify
Posted: 2015-08-12T01:41:46-07:00
by qubodup
To clarify, the command
Code: Select all
identify -format %[colorspace] test.jpg
can be used to get a string like for example '
sRGB' or '
Gray' with no newline ending.
Re: Getting colorspace using identify
Posted: 2015-08-12T09:20:40-07:00
by fmw42
you can introduce a new line ending by
Code: Select all
identify -format "%[colorspace]\n" test.jpg