Page 1 of 1

only need to determine colorspace of graphic

Posted: 2008-03-03T08:44:52-07:00
by Arlene
I have been using the identify -verbose command to determine what the colorspace of a graphic is from the log generated. Is there a quick and easy way to get the colorspace of a graphic without using the identify -verbose option?

Re: only need to determine colorspace of graphic

Posted: 2008-03-03T09:53:23-07:00
by magick
There is a fast way to get the image storage class and colorspace:
  • -> identify -format %r logo:
    PseudoClassRGB

Re: only need to determine colorspace of graphic

Posted: 2008-03-03T13:09:45-07:00
by fmw42
Perhaps the colorspace can be added in the future to the list of string formats that one can return. I use this often also in my scripts and have to extract it from the -verbose info using sed commands. Not high priority as it can be done, but seems like a good thing to be able to get to easily. Future Enhancement request. Thanks.


This is what I have been doing in my scripts:

data=`identify -verbose $infile`
colorspace=`echo "$data" | sed -n 's/^.*Colorspace: \([^ ]*\).*$/\1/p'`

which can be combined as

identify -verbose $infile | sed -n 's/^.*Colorspace: \([^ ]*\).*$/\1/p'

for direct readout in a terminal window

Re: only need to determine colorspace of graphic

Posted: 2008-03-03T13:20:52-07:00
by magick
Done. Tomorrow grab ImageMagick 6.3.9-2 Beta and use '%[colorspace]' to return just the image colorspace.

Re: only need to determine colorspace of graphic

Posted: 2008-03-03T13:26:51-07:00
by fmw42
Once again, magick, you amaze me at the speed at which you do some of these enhancements. That is terrific.

Re: only need to determine colorspace of graphic

Posted: 2008-03-04T10:19:10-07:00
by Arlene
I have downloaded the updated version 6.3.9-2 beta for windows ... I am not a programmer by trade so I need the command line for this new capability spelled out for me. Can you post a complete command line with the new %[colorspace] usage in it?

Re: only need to determine colorspace of graphic

Posted: 2008-03-04T10:43:36-07:00
by magick
Under Windows, try
  • identify -format %[colorspace] image.jpg
On Linux, its
  • identify -format '%[colorspace]' image.jpg
If it does not work you may need today's version of ImageMagick 6.3.9-2 Beta.

Re: only need to determine colorspace of graphic

Posted: 2008-03-04T14:18:50-07:00
by Arlene
Is there a binary release for windows on this new upgrade?

Re: only need to determine colorspace of graphic

Posted: 2008-03-04T15:52:26-07:00
by magick
We do not provide Window binary distributions for ImageMagick Beta releases.