RESOLVED: EPS Returning CMYK result for all type of color format

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
246246
Posts: 158
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by 246246 » 2015-08-22T00:27:44-07:00

fmw42 wrote:Using your latest grayscale image, I get:

Code: Select all

convert Grayscale.eps -format "%[fx:mean.c], %[fx:mean.m], %[fx:mean.y], %[fx:mean.k]\n" info:
0.00128133, 0.00116061, 0.00114715, 0.0431655

Which would seem to say it is color. But viewing the file, it looks grayscale.

Sorry, I do not know what to tell you when you have such messed up files.
Reason is simple. You see 2 values CMY !=0.

Code: Select all

$ identify -verbose Grayscale.eps | egrep '(Histogram:|cmyk)'  
  Histogram:
     40856: (    0,    0,    0,    0) #0000000000000000 cmyk(0,0,0,0)
       812: (    0,    0,    0,34952) #0000000000008888 cmyk(0,0,0,136)
       652: (    0,    0,    0,17476) #0000000000004444 cmyk(0,0,0,68)
       462: (    0,    0,    0,48059) #000000000000BBBB cmyk(0,0,0,187)
       298: (    0,    0,    0, 4369) #0000000000001111 cmyk(0,0,0,17)
       262: (    0,    0,    0,39321) #0000000000009999 cmyk(0,0,0,153)
       231: (    0,    0,    0,13107) #0000000000003333 cmyk(0,0,0,51)
       206: (    0,    0,    0,26214) #0000000000006666 cmyk(0,0,0,102)
       197: (    0,    0,    0, 8738) #0000000000002222 cmyk(0,0,0,34)
       151: (    0,    0,    0,43690) #000000000000AAAA cmyk(0,0,0,170)
       139: (    0,    0,    0,52428) #000000000000CCCC cmyk(0,0,0,204)
       137: (    0,    0,    0,21845) #0000000000005555 cmyk(0,0,0,85)
       120: (    0,    0,    0,65535) #000000000000FFFF cmyk(0,0,0,255)
        96: (    0,    0,    0,56797) #000000000000DDDD cmyk(0,0,0,221)
        62: (    0,    0,    0,30583) #0000000000007777 cmyk(0,0,0,119)
        42: (    0,    0,    0,61166) #000000000000EEEE cmyk(0,0,0,238)
         5: (    0,    0,    0,42919) #000000000000A7A7 cmyk(0,0,0,167)
         5: (    0,    0,    0,36494) #0000000000008E8E cmyk(0,0,0,142)
         5: (    0,    0,    0,20560) #0000000000005050 cmyk(0,0,0,80)
         4: (    0,    0,    0,53199) #000000000000CFCF cmyk(0,0,0,207)
         4: (    0,    0,    0,54998) #000000000000D6D6 cmyk(0,0,0,214)
         4: (    0,    0,    0,36751) #0000000000008F8F cmyk(0,0,0,143)
         4: (    0,    0,    0,58339) #000000000000E3E3 cmyk(0,0,0,227)
         4: (    0,    0,    0,57311) #000000000000DFDF cmyk(0,0,0,223)
         3: (    0,    0,    0,33410) #0000000000008282 cmyk(0,0,0,130)
         3: (    0,    0,    0,40863) #0000000000009F9F cmyk(0,0,0,159)
         3: (    0,    0,    0,23644) #0000000000005C5C cmyk(0,0,0,92)
         3: (    0,    0,    0,42662) #000000000000A6A6 cmyk(0,0,0,166)
         3: (    0,    0,    0,49344) #000000000000C0C0 cmyk(0,0,0,192)
         3: (    0,    0,    0,49087) #000000000000BFBF cmyk(0,0,0,191)
         3: (    0,    0,    0,38807) #0000000000009797 cmyk(0,0,0,151)
         3: (    0,    0,    0,47031) #000000000000B7B7 cmyk(0,0,0,183)
         3: (    0,    0,    0,55769) #000000000000D9D9 cmyk(0,0,0,217)
         2: (    0,    0,    0,59367) #000000000000E7E7 cmyk(0,0,0,231)
         2: (    0,    0,    0,27499) #0000000000006B6B cmyk(0,0,0,107)
         2: (    0,    0,    0,39835) #0000000000009B9B cmyk(0,0,0,155)
         2: (    0,    0,    0,46517) #000000000000B5B5 cmyk(0,0,0,181)
         2: (    0,    0,    0,52685) #000000000000CDCD cmyk(0,0,0,205)
         2: (    0,    0,    0,44461) #000000000000ADAD cmyk(0,0,0,173)
         2: (    0,    0,    0,26985) #0000000000006969 cmyk(0,0,0,105)
         2: (    0,    0,    0,51143) #000000000000C7C7 cmyk(0,0,0,199)
         1: (    0,    0,    0,60652) #000000000000ECEC cmyk(0,0,0,236)
         1: (    0,    0,    0,20046) #0000000000004E4E cmyk(0,0,0,78)
         1: (    0,    0,    0,61937) #000000000000F1F1 cmyk(0,0,0,241)
         1: (    0,    0,    0,44975) #000000000000AFAF cmyk(0,0,0,175)
         1: (    0,    0,    0,36237) #0000000000008D8D cmyk(0,0,0,141)
         1: (    0,    0,    0, 8224) #0000000000002020 cmyk(0,0,0,32)
         1: (    0,    0,    0,61423) #000000000000EFEF cmyk(0,0,0,239)
         1: (    0,    0,    0,53713) #000000000000D1D1 cmyk(0,0,0,209)
         1: (    0,    0,    0,49601) #000000000000C1C1 cmyk(0,0,0,193)
         1: (    0,    0,    0,46260) #000000000000B4B4 cmyk(0,0,0,180)
         1: (    0,    0,    0,56026) #000000000000DADA cmyk(0,0,0,218)
         1: (    0,    0,    0,62194) #000000000000F2F2 cmyk(0,0,0,242)
         1: (    0,    0,    0,64250) #000000000000FAFA cmyk(0,0,0,250)
         1: (    0,    0,    0,42405) #000000000000A5A5 cmyk(0,0,0,165)
         1: (39064,35466,34952,60395) #98988A8A8888EBEB cmyk(152,138,136,235)
        76: (49087,44461,43947,59110) #BFBFADADABABE6E6 cmyk(191,173,171,230)
  Background color: cmyk(255,255,255,0)
  Border color: cmyk(223,223,223,0)
  Matte color: cmyk(189,189,189,0)
  Transparent color: cmyk(0,0,0,0)
Last edited by 246246 on 2015-08-22T01:14:51-07:00, edited 2 times in total.

246246
Posts: 158
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by 246246 » 2015-08-22T00:52:47-07:00

newbeee wrote:
246246 wrote:I checked another way, it seems 1-RGB.eps is CMYK.

Even though I replace

%%DocumentProcessColors: Cyan Magenta Yellow Black

line to the same number of space (to keep the length), ImageMagick (and pdfimages) report it is CMYK.
Thanks 246246, So how can I find out the RGB?
Short Answer.
If the file is really RGB, your first program should return RGB.

Long Answer.
If I believe adobe forum, there should be not %%DocumentProcessColors: line, but it was discussed in years ago, so it now seems that might depends how to create eps files. I think Imagemagick does not always rely on that line. To get the best result, retract all image and check there colorspace one by one. As long as your eps has only images (i.e. not vector), pdfimages will do a good job.

But Indeed, your 1-CMYK.eps has vector graphics in it, I see that part in EPS and it is also CMYK. (I heard only older Illustrator can mix RGB and CMYK in one file, but I'm not sure because I don't use it.) So all visible/printable part, i.e. not a metadata part including thumbnail, is seems to be all CMYK.

newbeee
Posts: 17
Joined: 2015-08-20T21:48:05-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by newbeee » 2015-08-22T03:59:58-07:00

246246 wrote:
fmw42 wrote:Using your latest grayscale image, I get:

Code: Select all

convert Grayscale.eps -format "%[fx:mean.c], %[fx:mean.m], %[fx:mean.y], %[fx:mean.k]\n" info:
0.00128133, 0.00116061, 0.00114715, 0.0431655

Background color: cmyk(255,255,255,0)
Border color: cmyk(223,223,223,0)
Matte color: cmyk(189,189,189,0)
Transparent color: cmyk(0,0,0,0)
[/code]
I get your point, as per my understanding all the value of k is zero so we consider as a RGB? Is I am right?

246246
Posts: 158
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by 246246 » 2015-08-22T05:32:06-07:00

newbeee wrote: I get your point, as per my understanding all the value of k is zero so we consider as a RGB? Is I am right?
You misunderstand somewhere. If there is channel K, it is CMYK, no matter what the values are.

newbeee
Posts: 17
Joined: 2015-08-20T21:48:05-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by newbeee » 2015-08-22T08:33:35-07:00

246246 wrote:
newbeee wrote: I get your point, as per my understanding all the value of k is zero so we consider as a RGB? Is I am right?
You misunderstand somewhere. If there is channel K, it is CMYK, no matter what the values are.
So my grayscale image black value is zero right?

newbeee
Posts: 17
Joined: 2015-08-20T21:48:05-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by newbeee » 2015-08-22T08:58:37-07:00

Thanks for all your help to find out the solution, still I am facing some confusion to find out black or color. Kindly suggest me which is the best option is to differentiate the color and blackandwhite.

latest analyse this tag <xmpG:red> is only available for RGB, this is not available in CMYK or Grayscale images....

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

Re: EPS Returning CMYK result for all type of color format

Post by fmw42 » 2015-08-22T11:26:44-07:00

I reprocessed your new grayscale.eps and it is still the same as before

Code: Select all

convert Grayscale.eps -format "%[channels]\n" info:
cmyk

Code: Select all

convert Grayscale.eps -format "%[fx:mean.c], %[fx:mean.m], %[fx:mean.y], %[fx:mean.k]\n" info:
0.00128133, 0.00116061, 0.00114715, 0.0431655

This is not grayscale, since the CMY channels are not 0.

Even though it looks grayscale as user 246246 said, the histogram shows 1 bin with non-zero values in the CMY channels. So most of the file is gray, but there is at least one pixel that is not gray. From the histogram


1: (39064,35466,34952,60395) #98988A8A8888EBEB cmyk(152,138,136,235)
76: (49087,44461,43947,59110) #BFBFADADABABE6E6 cmyk(191,173,171,230)

These pixels have non-zero values in CMY, all the rest are C=0, M=0, Y=0. Thus you cannot classify this image a pure grayscale even though to the eye, it looks gray.

The test is:

C=0, M=0, Y=0 (mean values) then it is gray. Otherwise it is color.

If you want to accept some small mean value as a threshold for all CMY channels that is close enough to 0 for you, then you could consider those as (essentially) gray. That is up to you.

newbeee
Posts: 17
Joined: 2015-08-20T21:48:05-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by newbeee » 2015-08-22T19:16:09-07:00

fmw42 wrote:I reprocessed your new grayscale.eps and it is still the same as before
If you want to accept some small mean value as a threshold for all CMY channels that is close enough to 0 for you, then you could consider those as (essentially) gray. That is up to you.
Thanks experts, I can understand better than before, I need to mark this question as solved. I need to know one only thing I can directly use this Colorspace property in asp.net or getColorprofile method, kindly suggest and may I know which tool you are using for testing histogram? Kindly show some example to use getcolorprofile method in asp.net...

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

Re: EPS Returning CMYK result for all type of color format

Post by fmw42 » 2015-08-23T00:40:33-07:00

Sorry, I do not know ASP.NET nor Magick.NET.

newbeee
Posts: 17
Joined: 2015-08-20T21:48:05-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by newbeee » 2015-08-23T01:00:19-07:00

fmw42 wrote:Sorry, I do not know ASP.NET nor Magick.NET.
Thanks fmw42, I found the logic but need to know how to implement programmatic-ally, I think I placed my question in correct section, but I need help from the developer of imagemagick dll for c# and asp.net...

User avatar
dlemstra
Posts: 1513
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: EPS Returning CMYK result for all type of color format

Post by dlemstra » 2015-08-23T01:15:26-07:00

You can get the histogram with the Histogram method of the MagickImage class. But I think the real question is what do you want to do with the result? Why do you need to know if an image only contains values in the black channel?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

246246
Posts: 158
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by 246246 » 2015-08-23T02:04:59-07:00

newbeee wrote: latest analyse this tag <xmpG:red> is only available for RGB, this is not available in CMYK or Grayscale images....
This is only a metadata, which does not affect the view of the image. ImageMagick does not use this value when 'convert'-ing or 'identify'-ing or 'display'-ing. I guess you add RGB metadata to CMYK image by mistake or unintentionally added with some specific operation in Illustrator or other software.

newbeee
Posts: 17
Joined: 2015-08-20T21:48:05-07:00
Authentication code: 1151

Re: EPS Returning CMYK result for all type of color format

Post by newbeee » 2015-08-23T21:31:30-07:00

246246 wrote:
newbeee wrote: latest analyse this tag <xmpG:red> is only available for RGB, this is not available in CMYK or Grayscale images....
This is only a metadata, which does not affect the view of the image. ImageMagick does not use this value when 'convert'-ing or 'identify'-ing or 'display'-ing. I guess you add RGB metadata to CMYK image by mistake or unintentionally added with some specific operation in Illustrator or other software.
I am not added, these metadata are generated after the illustrator made changes. Any way thanks all for the cooperation of discussion. I need to mark this question as solved. How to do it???

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

Re: RESOLVED: EPS Returning CMYK result for all type of color format

Post by fmw42 » 2015-08-23T22:31:28-07:00

I have marked it RESOLVED for you. For future use, just edit the title of your very first post of any topic.

robert81
Posts: 7
Joined: 2018-08-17T05:03:19-07:00
Authentication code: 1152

Re: RESOLVED: EPS Returning CMYK result for all type of color format

Post by robert81 » 2018-08-17T08:47:46-07:00

Hi !

Is there any source code for reporting CMYK values automatically in a text file?

Suppose a 10*10 pixel image...is there any code to read the image and report each pixel CMYK value (here it will be 100 values) and export to a text file?

Post Reply