Conversion from CMYK to RGB color profile

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
Timo
Posts: 2
Joined: 2012-05-03T06:46:42-07:00
Authentication code: 13

Conversion from CMYK to RGB color profile

Post by Timo »

Version: ImageMagick 6.7.5-10 2012-03-04 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
Windows 7 Professional, SP1
HP ProBook 6550b

Trying to convert CMYK image to RGB image.
Input image http://imagepaste.nullnetwork.net/viewimage.php?id=3777

Code: Select all

C:/>identify -verbose C:/a.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 1760x1173+0+0
  Resolution: 203x203
  Print size: 8.66995x5.77833
  Units: PixelsPerInch
  Type: ColorSeparation
  Endianess: Undefined
  Colorspace: CMYK
  Depth: 8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
  Channel statistics:
    Cyan:
      min: 0 (0)
      max: 253 (0.992157)
      mean: 31.2438 (0.122525)
      standard deviation: 27.2698 (0.10694)
      kurtosis: 3.18323
      skewness: 1.42525
    Magenta:
      min: 0 (0)
      max: 255 (1)
      mean: 37.7891 (0.148193)
      standard deviation: 38.1924 (0.149774)
      kurtosis: 5.14955
      skewness: 2.01195
    Yellow:
      min: 0 (0)
      max: 255 (1)
      mean: 31.6085 (0.123955)
      standard deviation: 24.7667 (0.0971244)
      kurtosis: 0.664639
      skewness: 0.896505
    Black:
      min: 0 (0)
      max: 253 (0.992157)
      mean: 93.0947 (0.365077)
      standard deviation: 69.6869 (0.273282)
      kurtosis: -1.40902
      skewness: 0.0738086
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 48.434 (0.189937)
      standard deviation: 43.7949 (0.171745)
      kurtosis: 5.2959
      skewness: 2.35831
  Total ink density: 253%
  Rendering intent: Perceptual
  Gamma: 0.45455
  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)
  Interlace: None
  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)
  Compose: Over
  Page geometry: 1760x1173+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 93
  Orientation: Undefined
  Properties:
    comment: JPEG Pro
    date:create: 2012-05-03T14:42:13+03:00
    date:modify: 2012-05-03T16:40:48+03:00
    jpeg:colorspace: 4
    jpeg:sampling-factor: 1x1,1x1,1x1,1x1
    signature: 3004aae13641b58a888617f8b5a67ce75585ae73d0136b6333aab1537e1925f3
  Profiles:
    Profile-8bim: 26 bytes
    Profile-iptc: 13 bytes
      Created Date[2,55]: 20120224
  Artifacts:
    filename: C:/a.jpg
    verbose: true
  Tainted: False
  Filesize: 1.288MB
  Number pixels: 2.064M
  Pixels per second: 19.85MB
  User time: 0.094u
  Elapsed time: 0:01.104
  Version: ImageMagick 6.7.5-10 2012-03-04 Q16 http://www.imagemagick.org
and the convert command:

Code: Select all

convert C:/a.jpg -profile C:/srgb.icm -colorspace RGB C:/b.jpg
and the result:

Code: Select all

C:/>identify -verbose C:/b.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 1760x1173+0+0
  Resolution: 203x203
  Print size: 8.66995x5.77833
  Units: PixelsPerInch
  Type: TrueColor
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Red:
      min: 0 (0)
      max: 255 (1)
      mean: 148.469 (0.582231)
      standard deviation: 74.3576 (0.291598)
      kurtosis: -1.44924
      skewness: 0.0105481
    Green:
      min: 0 (0)
      max: 255 (1)
      mean: 142.997 (0.560771)
      standard deviation: 74.6031 (0.292561)
      kurtosis: -1.42518
      skewness: 0.114887
    Blue:
      min: 0 (0)
      max: 255 (1)
      mean: 147.202 (0.577262)
      standard deviation: 73.3071 (0.287479)
      kurtosis: -1.45954
      skewness: 0.0489431
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 146.222 (0.573421)
      standard deviation: 74.0914 (0.290555)
      kurtosis: -1.44344
      skewness: 0.0577695
  Rendering intent: Perceptual
  Gamma: 0.45455
  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)
  Interlace: None
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 1760x1173+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 93
  Orientation: Undefined
  Properties:
    comment: JPEG Pro
    date:create: 2012-05-03T16:41:59+03:00
    date:modify: 2012-05-03T16:52:06+03:00
    jpeg:colorspace: 2
    jpeg:sampling-factor: 1x1,1x1,1x1
    signature: 3419e6c91010e03cfb528ad353cabd6a56df6a315af59dceef3b08d51bd98569
  Profiles:
    Profile-8bim: 26 bytes
    Profile-icc: 3144 bytes
      Description: sRGB IEC61966-2.1
      Manufacturer: IEC http://www.iec.ch
      Model: IEC 61966-2.1 Default RGB colour space - sRGB
      Copyright: Copyright (c) 1998 Hewlett-Packard Company
    Profile-iptc: 13 bytes
      Created Date[2,55]: 20120224
  Artifacts:
    filename: C:/b.jpg
    verbose: true
  Tainted: False
  Filesize: 957KB
  Number pixels: 2.064M
  Pixels per second: 29.08MB
  User time: 0.078u
  Elapsed time: 0:01.070
  Version: ImageMagick 6.7.5-10 2012-03-04 Q16 http://www.imagemagick.org
but the b.jpg still shows the image in twisted colors. What do I do wrong here?

-Timo Ratilainen
stefan9
Posts: 15
Joined: 2012-02-22T00:56:56-07:00
Authentication code: 8675308

Re: Conversion from CMYK to RGB color profile

Post by stefan9 »

as far as i can see no profile included in your CMYK image.
for that your first -profile applies the (wrong!) srgb.icm to the image and then colorspace does some conversation ...

with no profile within input image try:

Code: Select all

convert "cmyk-in.jpg" -profile cmyk.icc -profile srgb.icm "out-rgb.jpg"
Timo
Posts: 2
Joined: 2012-05-03T06:46:42-07:00
Authentication code: 13

Re: Conversion from CMYK to RGB color profile

Post by Timo »

Thank you.
It seems to be some of my pictures have profile information and some do not. How can I check that image has cmyk profile? After the check I can execute different convert command in my Java code.

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

Re: Conversion from CMYK to RGB color profile

Post by fmw42 »

You can see if there are profiles listed as icc or icm in the verbose information.

identify -verbose yourimage
Post Reply