Quick identify of large (PSD) file color space?

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
sdaau
Posts: 10
Joined: 2011-05-23T03:49:56-07:00
Authentication code: 8675308

Quick identify of large (PSD) file color space?

Post by sdaau »

Hi all,

I have a B0 poster done as Inkscape SVG, which I'd want to rasterize to a CMYK psd @ 600 dpi. So, first I do:

Code: Select all

$ inkscape --file=infile.svg --export-area-page --export-dpi=600 --export-png=outfile.png

DPI: 600
Background RRGGBBAA: ffffffff
Area 0:0:2505,12:3543,31 exported to 16701 x 23622 pixels (600 dpi)
Bitmap saved as: outfile.png
So, I get a 600 dpi PNG; apparently compressed (29.7 MB); however, PNG can only be RGB.

So, then I use `convert` to generate a CMYK psd:

Code: Select all

$ convert -monitor -verbose outfile.png -colorspace cmyk outfile.psd

load image[outfile.png]: 23621 of 23622, 100% complete
outfile.png PNG 16701x23622 16701x23622+0+0 8-bit DirectClass 31.14MB 53.000u 1:22.649
negate image[outfile.psd]: 23621 of 23622, 100% complete
save images[outfile.psd]: 5 of 6, 100% complete
negate image[outfile.psd]: 23621 of 23622, 100% complete
outfile.png=>outfile.psd PNG 16701x23622 16701x23622+0+0 8-bit DirectClass 1.9726GB 323.150u 27:17.179
This takes very long time, and results with something like a 1.8GB file.

The problem is when I try to run `identify`, to check that the PSD file is really in CMYK color mode. Without a 'verbose' switch, that information is not displayed:

Code: Select all

$ identify -define unique=true outfile.psd

outfile.psd PSD 16701x23622 16701x23622+0+0 8-bit DirectClass 1.9726GB 2.730u 0:01.459
.. but if I do a 'verbose' switch, i.e.

Code: Select all

identify -verbose outfile.psd


.. then `identify` seemingly reads through *every* pixel in the image (possibly because, as far as I remember, `identify -verbose` also displays some sort of a histogram of the image) - and this takes forever as well (so far have been waiting at least 30 mins :) )

So, my question is - is there a way to persuade `identify` to display the color mode (or profile ?! i.e. CMYK, RGB) of an image, without it iterating through all pixels?

A subquestion is - is it possible to somehow get a compressed PSD as output of the `convert` process?

Thanks in advance for any answers,
Cheers!
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Quick identify of large (PSD) file color space?

Post by whugemann »

If I were you, I would do my first tests with a smaller image. You can however read only a (small) subsection of your large the image in Identify, see http://www.imagemagick.org/Usage/files/#read_mods.
Wolfgang Hugemann
sdaau
Posts: 10
Joined: 2011-05-23T03:49:56-07:00
Authentication code: 8675308

Re: Quick identify of large (PSD) file color space?

Post by sdaau »

Hi whugemann,

Thanks a lot for the prompt reply!

Thanks to your link, I have found http://www.imagemagick.org/Usage/files/#massive; read a bit there, and I thought this would work:

Code: Select all

stream -map rgb -storage-type char -extract 100x100+0+0 test.psd - | identify -verbose -size 100x100 rgb:-
... however, it seems that for psd files, the `stream` command still must run through and read the entire file first (since when I run the `convert` part on its own, it starts again working for a long time - however, if I run it with `outfile.png` as input file instead, it completes almost instantly.. )
If I were you, I would do my first tests with a smaller image.
Yes, it seems this is the most reasonable way to do this kind of thing..

Thanks a lot for the help,

Cheers!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Quick identify of large (PSD) file color space?

Post by fmw42 »

see string formats at http://www.imagemagick.org/script/escape.php

try %r or %[colorspace]

convert image -format "%[colorspace]" info:
Post Reply