only need to determine colorspace of graphic

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
Arlene

only need to determine colorspace of graphic

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: only need to determine colorspace of graphic

Post by magick »

There is a fast way to get the image storage class and colorspace:
  • -> identify -format %r logo:
    PseudoClassRGB
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: only need to determine colorspace of graphic

Post 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
Last edited by fmw42 on 2008-03-03T13:24:52-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: only need to determine colorspace of graphic

Post by magick »

Done. Tomorrow grab ImageMagick 6.3.9-2 Beta and use '%[colorspace]' to return just the image colorspace.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: only need to determine colorspace of graphic

Post by fmw42 »

Once again, magick, you amaze me at the speed at which you do some of these enhancements. That is terrific.
Arlene

Re: only need to determine colorspace of graphic

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: only need to determine colorspace of graphic

Post 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.
Arlene

Re: only need to determine colorspace of graphic

Post by Arlene »

Is there a binary release for windows on this new upgrade?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: only need to determine colorspace of graphic

Post by magick »

We do not provide Window binary distributions for ImageMagick Beta releases.
Post Reply