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

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Rumcajs
Posts: 4
Joined: 2018-08-04T07:15:13-07:00
Authentication code: 1152

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

Post 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
Last edited by Rumcajs on 2018-08-04T08:29:26-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: identify don't gives serious information about colorspace

Post 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
snibgo's IM pages: im.snibgo.com
Rumcajs
Posts: 4
Joined: 2018-08-04T07:15:13-07:00
Authentication code: 1152

Re: identify don't gives serious information about colorspace

Post 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
Post Reply