Page 1 of 1

Convert Tiff Grayscale to CMYK wrong colors

Posted: 2016-02-09T07:44:34-07:00
by tlichev
Hello all,

I found a strange behavior converting a grayscale tiff to cmyk (ImageMagick-6.8.9-5)
The used images:
the input imagehttp://www.filedropper.com/original_5
the result http://www.filedropper.com/originaloutput

The command I use is

Code: Select all

convert s:/original.tif -profile s:/profiles/cmyk/USWebCoatedSWOP.icc TIFF:d:\original_output.tif 
When I open the output file with Photoshop the colors look wrong.Image

The result of identify

Code: Select all

C:\Program Files\ImageMagick-6.8.9-5>identify -ping -verbose d:\original_output.tif
Image: d:\original_output.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: DirectClass
  Geometry: 454x340+0+0
  Resolution: 300x300
  Print size: 1.51333x1.13333
  Units: PixelsPerInch
  Type: ColorSeparation
  Base type: ColorSeparation
  Endianess: MSB
  Colorspace: CMYK
  Depth: 8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
  Channel statistics:
    Cyan:
      min: 64 (0.25098)
      max: 162 (0.635294)
      mean: 83.8556 (0.328845)
      standard deviation: 39.302 (0.154125)
      kurtosis: 0.193724
      skewness: 1.47937
    Magenta:
      min: 52 (0.203922)
      max: 146 (0.572549)
      mean: 71.0338 (0.278564)
      standard deviation: 37.6866 (0.147791)
      kurtosis: 0.197156
      skewness: 1.48045
    Yellow:
      min: 53 (0.207843)
      max: 144 (0.564706)
      mean: 71.4303 (0.280119)
      standard deviation: 36.4867 (0.143085)
      kurtosis: 0.196071
      skewness: 1.48008
    Black:
      min: 0 (0)
      max: 87 (0.341176)
      mean: 17.5093 (0.068664)
      standard deviation: 34.8248 (0.136568)
      kurtosis: 0.22483
      skewness: 1.49031
  Image statistics:
    Overall:
      min: 0 (0)
      max: 162 (0.635294)
      mean: 60.9573 (0.239048)
      standard deviation: 37.1112 (0.145534)
      kurtosis: 3.87571
      skewness: 1.31499
  Total ink density: 211.373%
  Colors: 86
  Histogram:
    122704: ( 64, 52, 53,  0) #40343500 cmyk(64,52,53,0)
        33: ( 65, 53, 54,  0) #41353600 cmyk(65,53,54,0)
        21: ( 67, 55, 56,  0) #43373800 cmyk(67,55,56,0)
        19: ( 68, 55, 57,  0) #44373900 cmyk(68,55,57,0)
        19: ( 68, 56, 57,  0) #44383900 cmyk(68,56,57,0)
        17: ( 70, 58, 59,  0) #463A3B00 cmyk(70,58,59,0)
        10: ( 71, 59, 60,  0) #473B3C00 cmyk(71,59,60,0)
        15: ( 72, 60, 61,  0) #483C3D00 cmyk(72,60,61,0)
         8: ( 74, 61, 62,  0) #4A3D3E00 cmyk(74,61,62,0)
        14: ( 75, 62, 63,  0) #4B3E3F00 cmyk(75,62,63,0)
        15: ( 76, 63, 64,  0) #4C3F4000 cmyk(76,63,64,0)
         9: ( 78, 65, 66,  0) #4E414200 cmyk(78,65,66,0)
         8: ( 79, 65, 67,  0) #4F414300 cmyk(79,65,67,0)
         8: ( 80, 66, 67,  0) #50424300 cmyk(80,66,67,0)
         5: ( 82, 68, 69,  0) #52444500 cmyk(82,68,69,0)
         2: ( 83, 69, 70,  0) #53454600 cmyk(83,69,70,0)
         7: ( 84, 70, 71,  0) #54464700 cmyk(84,70,71,0)
         8: ( 87, 72, 73,  0) #57484900 cmyk(87,72,73,0)
        10: ( 88, 73, 74,  0) #58494A00 cmyk(88,73,74,0)
         7: ( 89, 73, 75,  0) #59494B00 cmyk(89,73,75,0)
        12: ( 91, 75, 77,  0) #5B4B4D00 cmyk(91,75,77,0)
         5: ( 92, 76, 78,  0) #5C4C4E00 cmyk(92,76,78,0)
         2: ( 94, 78, 80,  0) #5E4E5000 cmyk(94,78,80,0)
         5: ( 95, 79, 81,  1) #5F4F5101 cmyk(95,79,81,1)
         7: ( 96, 80, 82,  1) #60505201 cmyk(96,80,82,1)
        13: ( 98, 82, 83,  1) #62525301 cmyk(98,82,83,1)
         9: ( 99, 83, 84,  1) #63535401 cmyk(99,83,84,1)
         5: (100, 84, 85,  1) #64545501 cmyk(100,84,85,1)
         2: (102, 85, 87,  2) #66555702 cmyk(102,85,87,2)
         4: (103, 86, 88,  2) #67565802 cmyk(103,86,88,2)
        12: (104, 87, 89,  2) #68575902 cmyk(104,87,89,2)
         8: (106, 89, 91,  2) #6A595B02 cmyk(106,89,91,2)
         5: (107, 90, 92,  3) #6B5A5C03 cmyk(107,90,92,3)
         5: (108, 90, 92,  3) #6C5A5C03 cmyk(108,90,92,3)
        10: (110, 92, 94,  4) #6E5C5E04 cmyk(110,92,94,4)
        16: (111, 93, 94,  4) #6F5D5E04 cmyk(111,93,94,4)
         5: (112, 94, 95,  5) #705E5F05 cmyk(112,94,95,5)
         7: (113, 95, 96,  5) #715F6005 cmyk(113,95,96,5)
         5: (114, 96, 97,  6) #72606106 cmyk(114,96,97,6)
         6: (115, 97, 98,  6) #73616206 cmyk(115,97,98,6)
        14: (117, 99, 99,  8) #75636308 cmyk(117,99,99,8)
        11: (118,100,100,  8) #76646408 cmyk(118,100,100,8)
         8: (119,100,101,  9) #77646509 cmyk(119,100,101,9)
         4: (121,102,102, 10) #7966660A cmyk(121,102,102,10)
         7: (121,103,103, 11) #7967670B cmyk(121,103,103,11)
        11: (122,104,104, 12) #7A68680C cmyk(122,104,104,12)
         6: (124,105,106, 13) #7C696A0D cmyk(124,105,106,13)
         8: (125,106,106, 14) #7D6A6A0E cmyk(125,106,106,14)
         5: (126,107,107, 15) #7E6B6B0F cmyk(126,107,107,15)
         7: (127,109,109, 16) #7F6D6D10 cmyk(127,109,109,16)
        13: (128,109,110, 17) #806D6E11 cmyk(128,109,110,17)
         7: (129,110,110, 18) #816E6E12 cmyk(129,110,110,18)
         5: (131,112,112, 20) #83707014 cmyk(131,112,112,20)
        12: (132,113,113, 21) #84717115 cmyk(132,113,113,21)
         6: (132,113,114, 22) #84717216 cmyk(132,113,114,22)
         5: (134,115,115, 24) #86737318 cmyk(134,115,115,24)
         3: (135,116,116, 25) #87747419 cmyk(135,116,116,25)
         6: (136,117,117, 27) #8875751B cmyk(136,117,117,27)
         7: (138,119,118, 29) #8A77761D cmyk(138,119,118,29)
         5: (138,120,119, 30) #8A78771E cmyk(138,120,119,30)
        11: (139,120,120, 31) #8B78781F cmyk(139,120,120,31)
        11: (141,122,122, 34) #8D7A7A22 cmyk(141,122,122,34)
         6: (141,123,122, 35) #8D7B7A23 cmyk(141,123,122,35)
         3: (142,124,123, 36) #8E7C7B24 cmyk(142,124,123,36)
         9: (144,125,125, 39) #907D7D27 cmyk(144,125,125,39)
        11: (144,126,125, 41) #907E7D29 cmyk(144,126,125,41)
         4: (146,128,127, 43) #92807F2B cmyk(146,128,127,43)
        10: (147,128,128, 45) #9380802D cmyk(147,128,128,45)
        16: (147,129,128, 46) #9381802E cmyk(147,129,128,46)
        12: (149,131,130, 51) #95838233 cmyk(149,131,130,51)
        10: (149,131,130, 49) #95838231 cmyk(149,131,130,49)
        10: (150,132,131, 52) #96848334 cmyk(150,132,131,52)
         8: (151,134,132, 55) #97868437 cmyk(151,134,132,55)
        15: (152,134,133, 57) #98868539 cmyk(152,134,133,57)
         7: (153,135,134, 59) #9987863B cmyk(153,135,134,59)
        13: (154,137,135, 62) #9A89873E cmyk(154,137,135,62)
        16: (155,138,136, 64) #9B8A8840 cmyk(155,138,136,64)
        16: (156,138,137, 65) #9C8A8941 cmyk(156,138,137,65)
        16: (157,140,138, 69) #9D8C8A45 cmyk(157,140,138,69)
        17: (157,141,139, 71) #9D8D8B47 cmyk(157,141,139,71)
        14: (158,141,140, 73) #9E8D8C49 cmyk(158,141,140,73)
        19: (159,143,141, 77) #9F8F8D4D cmyk(159,143,141,77)
        11: (160,143,142, 79) #A08F8E4F cmyk(160,143,142,79)
        24: (160,144,142, 81) #A0908E51 cmyk(160,144,142,81)
        24: (161,145,144, 85) #A1919055 cmyk(161,145,144,85)
     30815: (162,146,144, 87) #A2929057 cmyk(162,146,144,87)
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  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)
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 454x340+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: None
  Orientation: TopLeft
  Properties:
    date:create: 2016-02-09T13:22:36+02:00
    date:modify: 2016-02-09T13:02:02+02:00
    dc:format: image/tiff
    icc:copyright: Copyright 2000 Adobe Systems, Inc.
    icc:description: U.S. Web Coated (SWOP) v2
    icc:manufacturer: U.S. Web Coated (SWOP) v2
    icc:model: U.S. Web Coated (SWOP) v2
    photoshop:ColorMode: 1
    photoshop:ICCProfile: Dot Gain 20%
    signature: 8c5e538a38bbf94f1a9ae13bbce00ca781104f885b2e1d75e447a6192b7cd1cc
    tiff:endian: lsb
    tiff:photometric: separated
    tiff:rows-per-strip: 4
    xmp:CreateDate: 2016-02-09T12:54:22+02:00
    xmp:CreatorTool: Adobe Photoshop CS5.1 Windows
    xmp:MetadataDate: 2016-02-09T12:54:22+02:00
    xmp:ModifyDate: 2016-02-09T12:54:22+02:00
    xmpMM:DocumentID: xmp.did:5E8F406815CFE51186BCF7673E33BE7F
    xmpMM:InstanceID: xmp.iid:5E8F406815CFE51186BCF7673E33BE7F
    xmpMM:OriginalDocumentID: xmp.did:5E8F406815CFE51186BCF7673E33BE7F
  Profiles:
    Profile-8bim: 7270 bytes
    Profile-icc: 557168 bytes
    Profile-tiff:37724: 12528 bytes
    Profile-xmp: 14086 bytes
  Artifacts:
    filename: d:\original_output.tif
    verbose: true
  Tainted: False
  Filesize: 1.21MB
  Number pixels: 154K
  Pixels per second: 9.08MB
  User time: 0.000u
  Elapsed time: 0:01.017
  Version: ImageMagick 6.8.9-5 Q16 x86 2014-06-26 http://www.imagemagick.org
Could someone tell me if there is an PS problem or IM does not convert the image properly with this command?

Re: Convert Tiff Grayscale to CMYK wrong colors

Posted: 2016-02-09T10:54:26-07:00
by snibgo
I can't download your original.tif to check it (some problem with filedropper). Does it have an embedded profile? If not, then your command needs changing.

If the input has no embedded profile, then the first "-profile" merely assigns a profile. The second does a conversion. So your first "-profile" should be "sRGB.icc" or similar.

Re: Convert Tiff Grayscale to CMYK wrong colors

Posted: 2016-02-09T10:59:35-07:00
by fmw42
snibgo,

The download link is further down the page. I had the same problem. Not an easy site to work with. The file has a 20% dot gain imbedded profile. I do not know if IM can handle dot gain. I tried the same command and got the same results. It looks blue in Photoshop after the conversion.

Re: Convert Tiff Grayscale to CMYK wrong colors

Posted: 2016-02-09T11:48:40-07:00
by snibgo
Okay, I got it. (The problem was that I have generally disabled scripts on websites.)

The input has 3 images. They all have "Dot Gain 20%" profile, whatever that is. I'll look at just the first image. Examining the ICC, it operates on one channel, lowering the middle values, like a gamma curve. I suppose the purpose is to compensate for printers with "large dots".

So a plausible conversion is first to convert to sRGB (to remove the "large dots" compensation), then convert to whatever you want, eg:

Code: Select all

convert original.tif[0] -profile sRGB.icc -profile s:/profiles/cmyk/USWebCoatedSWOP.icc out.tiff

Re: Convert Tiff Grayscale to CMYK wrong colors

Posted: 2016-02-09T11:53:40-07:00
by fmw42
I tried that with no success, though I did all layers.

Oddly, IM says there are 3 layers, but my old Photoshop (CS) only sees 2 layers.

I will try again with only the first layer.

Re: Convert Tiff Grayscale to CMYK wrong colors

Posted: 2016-02-09T13:22:03-07:00
by fmw42
This works to keep it gray and not blue, but the background gray is changed a bit.

Code: Select all

convert original.tif[0] -strip -profile /Users/fred/images/profiles/sRGB.icc /Users/fred/images/profiles/USWebCoatedSWOP.icc -type truecolor result.tif

Re: Convert Tiff Grayscale to CMYK wrong colors

Posted: 2016-02-10T01:00:30-07:00
by tlichev
Thank you for the replies.
I have noticed that -strip makes the result a bit better but I don't want to strip the profiles and the exif data.