Page 1 of 1

[Solved] identify don't gives serious information about colorspace

Posted: 2018-08-04T07:57:16-07:00
by Rumcajs
Hi,

identify don't gives serious information about colorspace, its like lotto, like drop a coin.

here we have a simple PDF-File (i have created it) : https://drive.google.com/open?id=1t3BMJ ... yI17lOBQyi
This pdf has 2 images embedded, one image (RGB), another (CMYK).

So if i do : "identify -format "%[colorspace]" sample.pdf" the result is CMYK,
if i try "identify -format %r sample.pdf" the result is DirectClass CMYK.
How the ... it can by CMYK if it has RGB elements embedded to ?

What output i expect ?

Colorspaces count (or call it like Adobe : Plates) : 2
1. RGB
2. CMYK

or as one liner :

Colorspaces count : 2, RGB, CMYK

Cheers

Re: identify don't gives serious information about colorspace

Posted: 2018-08-04T08:09:51-07:00
by snibgo
Rumcajs wrote:This pdf has 2 images embedded, one image (RGB), another (CMYK).
IM knows nothing about raster images embedded within a PDF. It is concerned only with the raster image(s) returned by Ghostscript. GS returns one image per PDF page, even if pages contain multiple embedded images. For your PDF, there is only one page. So there is only one colorspace.

If you want to process embedded images, rather than images of PDF pages, I suggest you first extract the images with pdfimages:

Code: Select all

f:\web\im>pdfimages -all sample.pdf abcd

f:\web\im>identify abcd-*
abcd-000.png PNG 150x150 150x150+0+0 8-bit sRGB 3952B 0.000u 0:00.000
abcd-001.tif TIFF 150x150 150x150+0+0 8-bit CMYK 90326B 0.000u 0:00.000

Re: identify don't gives serious information about colorspace

Posted: 2018-08-04T08:27:33-07:00
by Rumcajs
snibgo wrote: 2018-08-04T08:09:51-07:00 IM knows nothing about raster images embedded within a PDF. It is concerned only with the raster image(s) returned by Ghostscript. GS returns one image per PDF page, even if pages contain multiple embedded images. For your PDF, there is only one page. So there is only one colorspace.

If you want to process embedded images, rather than images of PDF pages, I suggest you first extract the images with pdfimages:

Code: Select all

f:\web\im>pdfimages -all sample.pdf abcd

f:\web\im>identify abcd-*
abcd-000.png PNG 150x150 150x150+0+0 8-bit sRGB 3952B 0.000u 0:00.000
abcd-001.tif TIFF 150x150 150x150+0+0 8-bit CMYK 90326B 0.000u 0:00.000
Thx for the information snibgo, i understand now how this works with GS, it a bit confusing because its don't report the true colorspaces only that one of the flatten image...
Thx for the tip with pdfimages, i will write a little script that gives me a one line output like : "Colorspaces count : 2, RGB, CMYK" and my problem will be solved.

Cheers