brightness issue converting from tif to png

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?".
mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

brightness issue converting from tif to png

Post by mnougarede »

Hi,

I'm getting stuck trying to understand why i have a brightness issue while converting some tif to png.
Does anyone have a clue about how i could solve it?

Command :

Code: Select all

convert original.tif -thumbnail 1920> -quality 100 -profile sRGB.icc original.png
Color Profile: www.color.org/profiles/sRGB2014.icc

Environments :

Code: Select all

OS: CentOS 7
Version: ImageMagick 6.9.8-10 Q16 x86_64 2017-07-11 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): bzlib djvu fontconfig freetype jng jpeg lcms lzma openexr pangocairo png tiff wmf x xml zlib

Code: Select all

OS: Windows 7
Version: ImageMagick 7.0.6-5 Q16 x64 2017-08-03 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
Image (tif and the png showing the brightness issue) :

https://lion.box.com/s/5erw2ucfjr4fqsy0lcc0xjhtnp95d6tv
Last edited by mnougarede on 2017-08-10T09:40:36-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: brightness issue converting from tif to png

Post by snibgo »

168MB is too large for me to download. Sorry.

You might:

Code: Select all

identify -verbose original.tif >test.txt
... and paste the text here.
snibgo's IM pages: im.snibgo.com
mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede »

Hi,


The original tif :

Code: Select all

identify -verbose originalFL.tif
Image: originalFL.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: DirectClass
  Geometry: 8424x5616+0+0
  Resolution: 600x600
  Print size: 14.04x9.36
  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:
    Pixels: 47309184
    Cyan:
      min: 0 (0)
      max: 255 (1)
      mean: 126.434 (0.49582)
      standard deviation: 70.9991 (0.278428)
      kurtosis: -0.735074
      skewness: -0.0942856
      entropy: 0.951055
    Magenta:
      min: 0 (0)
      max: 247 (0.968627)
      mean: 63.9318 (0.250713)
      standard deviation: 48.4632 (0.190052)
      kurtosis: -0.40339
      skewness: 0.579301
      entropy: 0.898444
    Yellow:
      min: 0 (0)
      max: 255 (1)
      mean: 106.95 (0.419413)
      standard deviation: 80.5836 (0.316014)
      kurtosis: -1.13556
      skewness: 0.368161
      entropy: 0.954987
    Black:
      min: 0 (0)
      max: 255 (1)
      mean: 101.908 (0.399641)
      standard deviation: 81.1247 (0.318136)
      kurtosis: -1.21055
      skewness: 0.214714
      entropy: 0.900881
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 99.8062 (0.391397)
      standard deviation: 71.5271 (0.280498)
      kurtosis: -0.465862
      skewness: 0.43939
      entropy: 0.926342
  Total ink density: 336.863%
  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: 8424x5616+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: None
  Orientation: TopLeft
  Properties:
    date:create: 2017-08-10T13:10:43+02:00
    date:modify: 2017-08-10T12:12:59+02:00
    dc:format: image/tiff
    exif:ApertureValue: 8
    exif:CustomRendered: 0
    exif:DateTimeDigitized: 2017:05:31 12:27:48
    exif:DateTimeOriginal: 2017:05:31 12:27:48
    exif:ExposureBiasValue: 0
    exif:ExposureMode: 1
    exif:ExposureProgram: 1
    exif:ExposureTime: 2
    exif:Flash: 16
    exif:FNumber: 16
    exif:FocalLength: 27
    exif:FocalPlaneResolutionUnit: 2
    exif:FocalPlaneXResolution: 3849.21
    exif:FocalPlaneYResolution: 3908.14
    exif:ISOSpeedRatings: 100
    exif:MaxApertureValue: 3
    exif:MeteringMode: 5
    exif:PixelXDimension: 8424
    exif:PixelYDimension: 5616
    exif:SceneCaptureType: 0
    exif:ShutterSpeedValue: -1
    exif:SubSecTimeOriginal: 28
    exif:WhiteBalance: 0
    icc:copyright: PrintOpen 5.2.0 - (c) Copyright 2000-2006 Heidelberger Druckm
aschinen AG. All Rights Reserved.
    icc:description: ISO Coated v2 (ECI)
    icc:manufacturer: ISO Coated v2 (ECI)
    icc:model: ISO Coated v2 (ECI)
    photoshop:ColorMode: 4
    photoshop:DateCreated: 2017-05-31T12:27:48.028
    photoshop:ICCProfile: ISO Coated v2 (ECI)
    signature: b8daf235f5d92be3a240f10ddf83052a71ef7edc0c0e590e04218501699b2f65
    tiff:alpha: unspecified
    tiff:endian: msb
    tiff:make: Canon
    tiff:model: Canon EOS 5D Mark II
    tiff:photometric: separated
    tiff:rows-per-strip: 1
    tiff:software: Adobe Photoshop CC 2017 (Macintosh)
    tiff:timestamp: 2017:08:10 12:12:38
    xmp:CreateDate: 2017-05-31T12:27:48
    xmp:CreatorTool: Adobe Photoshop CC 2017 (Macintosh)
    xmp:MetadataDate: 2017-08-10T12:12:38+02:00
    xmp:ModifyDate: 2017-08-10T12:12:38+02:00
    xmpMM:DerivedFrom: xmp.did:7ae28b6e-ecb1-48fb-8a61-1c0281c843e1
    xmpMM:DocumentID: adobe:docid:photoshop:d4561c7d-be42-117a-829a-dab252f6b7cb

    xmpMM:InstanceID: xmp.iid:5e887ddb-7441-43fa-ae8f-357d4c721d36
    xmpMM:OriginalDocumentID: xmp.did:7ae28b6e-ecb1-48fb-8a61-1c0281c843e1
  Profiles:
    Profile-8bim: 10662 bytes
    Profile-icc: 1829077 bytes
    Profile-xmp: 16967 bytes
  Artifacts:
    filename: originalFL.tif
    verbose: true
  Tainted: False
  Filesize: 191.1MB
  Number pixels: 47.31M
  Pixels per second: 28.52MB
  User time: 0.390u
  Elapsed time: 0:02.658
  Version: ImageMagick 6.9.7-6 Q16 x64 2017-01-27 http://www.imagemagick.org
identify.exe: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNorma
lTag' @ warning/tiff.c/TIFFWarnings/912.
identify.exe: Unknown field with tag 42033 (0xa431) encountered. `TIFFReadCustom
Directory' @ warning/tiff.c/TIFFWarnings/912.
identify.exe: Unknown field with tag 42034 (0xa432) encountered. `TIFFReadCustom
Directory' @ warning/tiff.c/TIFFWarnings/912.
identify.exe: Unknown field with tag 42036 (0xa434) encountered. `TIFFReadCustom
Directory' @ warning/tiff.c/TIFFWarnings/912.
identify.exe: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNorma
lTag' @ warning/tiff.c/TIFFWarnings/912.
The converted png :

Code: Select all

identify -verbose originalFL.png
Image: originalFL.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 8424x5616+0+0
  Resolution: 236.22x236.22
  Print size: 35.6617x23.7744
  Units: PixelsPerCentimeter
  Type: TrueColor
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Pixels: 47309184
    Red:
      min: 0 (0)
      max: 255 (1)
      mean: 106.767 (0.418695)
      standard deviation: 77.5621 (0.304165)
      kurtosis: -0.808231
      skewness: 0.6436
      entropy: 0.953691
    Green:
      min: 0 (0)
      max: 255 (1)
      mean: 128.694 (0.504682)
      standard deviation: 75.6696 (0.296744)
      kurtosis: -1.08149
      skewness: 0.315329
      entropy: 0.959036
    Blue:
      min: 0 (0)
      max: 255 (1)
      mean: 114.225 (0.44794)
      standard deviation: 81.2852 (0.318766)
      kurtosis: -1.12557
      skewness: 0.385564
      entropy: 0.955032
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 116.562 (0.457106)
      standard deviation: 78.2071 (0.306695)
      kurtosis: -0.988514
      skewness: 0.439114
      entropy: 0.95592
  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)
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 8424x5616+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2017-08-10T13:11:49+02:00
    date:modify: 2017-08-10T13:13:53+02:00
    dc:format: image/tiff
    exif:ApertureValue: 8
    exif:CustomRendered: 0
    exif:DateTimeDigitized: 2017:05:31 12:27:48
    exif:DateTimeOriginal: 2017:05:31 12:27:48
    exif:ExposureBiasValue: 0
    exif:ExposureMode: 1
    exif:ExposureProgram: 1
    exif:ExposureTime: 2
    exif:Flash: 16
    exif:FNumber: 16
    exif:FocalLength: 27
    exif:FocalPlaneResolutionUnit: 2
    exif:FocalPlaneXResolution: 3849.21
    exif:FocalPlaneYResolution: 3908.14
    exif:ISOSpeedRatings: 100
    exif:MaxApertureValue: 3
    exif:MeteringMode: 5
    exif:PixelXDimension: 8424
    exif:PixelYDimension: 5616
    exif:SceneCaptureType: 0
    exif:ShutterSpeedValue: -1
    exif:SubSecTimeOriginal: 28
    exif:WhiteBalance: 0
    icc:copyright: Copyright 2007 International Color Consortium
    icc:description: sRGB v4 ICC preference perceptual intent beta
    icc:manufacturer: sRGB v4 ICC preference perceptual intent beta
    icc:model: sRGB v4 ICC preference perceptual intent beta
    photoshop:ColorMode: 4
    photoshop:DateCreated: 2017-05-31T12:27:48.028
    photoshop:ICCProfile: ISO Coated v2 (ECI)
    png:bKGD: chunk was found (see Background color, above)
    png:cHRM: chunk was found (see Chromaticity, above)
    png:gAMA: gamma=0.45455 (See Gamma, above)
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 2
    png:IHDR.color_type: 2 (Truecolor)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 8424, 5616
    png:pHYs: x_res=23622, y_res=23622, units=1
    png:sRGB: intent=0 (Perceptual Intent)
    png:text: 49 tEXt/zTXt/iTXt chunks were found
    png:tIME: 2017-08-10T12:12:59Z
    signature: 2f60aed8f37bec18f1f875b272b6403d74e3918c20dc48904c76c5c326952b91
    tiff:alpha: unspecified
    tiff:endian: msb
    tiff:make: Canon
    tiff:model: Canon EOS 5D Mark II
    tiff:photometric: separated
    tiff:rows-per-strip: 5616
    tiff:software: Adobe Photoshop CC 2017 (Macintosh)
    tiff:timestamp: 2017:08:10 12:12:38
    xmp:CreateDate: 2017-05-31T12:27:48
    xmp:CreatorTool: Adobe Photoshop CC 2017 (Macintosh)
    xmp:MetadataDate: 2017-08-10T12:12:38+02:00
    xmp:ModifyDate: 2017-08-10T12:12:38+02:00
    xmpMM:DerivedFrom: xmp.did:7ae28b6e-ecb1-48fb-8a61-1c0281c843e1
    xmpMM:DocumentID: adobe:docid:photoshop:d4561c7d-be42-117a-829a-dab252f6b7cb

    xmpMM:InstanceID: xmp.iid:5e887ddb-7441-43fa-ae8f-357d4c721d36
    xmpMM:OriginalDocumentID: xmp.did:7ae28b6e-ecb1-48fb-8a61-1c0281c843e1
  Artifacts:
    filename: originalFL.png
    verbose: true
  Tainted: False
  Filesize: 55.56MB
  Number pixels: 47.31M
  Pixels per second: 22.73MB
  User time: 1.685u
  Elapsed time: 0:03.080
  Version: ImageMagick 6.9.7-6 Q16 x64 2017-01-27 http://www.imagemagick.org
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: brightness issue converting from tif to png

Post by snibgo »

I can't see any reason for a problem. The input tif has an embedded CMYK profile, and is successfully converted to an sRGB profile, which is embedded.

Your version of IM, 6.9.7-6, is recent, so that's not a problem.

Sorry, I'm not much help. How do you know you have a problem? What are you comparing IM's result against?
snibgo's IM pages: im.snibgo.com
mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede »

Hi,

The problem is when displaying the original tif and the converted png on my screen the colors are different.
The convert png image is more bright than it's original tif.

I don't have this issue when converting using nconvert tool for example:

Code: Select all

nconvert -icc -out -o original.png original.tif
I don't want to switch my app to nconvert until i fully understand my problem.

Best regards,
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: brightness issue converting from tif to png

Post by snibgo »

mnougarede wrote:The problem is when displaying the original tif and the converted png on my screen the colors are different.
Yes, but your screen isn't CMYK, so something is converting the tif. You are comparing IM's conversion to some other conversion.
snibgo's IM pages: im.snibgo.com
mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede »

Hi,

I understand your argument.

But i just found that when i convert the CMYK tif to a sRGB tif the colors are kept.
But when converting the resulting tif sRGB in png, the colors are more bright.

The same conversion from CMYK tif to sRGB jpg went fine.

So from my understanding this does not seems to be a CMYK sRGB conversion issue but more an issue when converting CMYK tif to sRGB png.

Any clue?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: brightness issue converting from tif to png

Post by snibgo »

You convert your tif to sRGB tif and to sRGB png, and find "the colors are more bright" in the png. Do they both have an embedded sRGB profile? And are the mean values the same? "identify -verbose" will tell you.

I would expect both files have embedded profiles, and their mean values are the same.
snibgo's IM pages: im.snibgo.com
mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede »

Hi,

you can find the results from the conversion in png and jpg here:
https://lion.box.com/s/k5hrvy275h20z131i8awufdbsqvdudnd

jpg

Red:
mean jpg: 106.595 (0.418019)
mean png: 106.582 (0.417968)
Green:
mean jpg: 128.429 (0.503641)
mean png: 128.419 (0.503603)
Blue:
mean jpg: 113.996 (0.447042)
mean png: 114.06 (0.447296)
Image statistics:
mean jpg: 116.34 (0.456234)
mean png: 87.2653 (0.342217)

Best regards,
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: brightness issue converting from tif to png

Post by snibgo »

Yes, the png is very slightly lighter than the jpeg. But you were comparing png and tiff. Why bring in jpeg?

Perhaps your tiff is compressed with jpeg. Well, jpeg compression is lossy. A jpeg-compressed image may be slightly lighter or darker than an uncompressed image.
snibgo's IM pages: im.snibgo.com
mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede »

To resume:

Conversion from CMYK tif to:

sRGB png -> lighter (convert original.tif 1920> -quality 100 -profile sRGB.icc original.png)
sRGB tif -> OK (convert original.tif 1920> -quality 100 -profile sRGB.icc original.tif)
sRGB jpg -> OK (convert original.tif 1920> -quality 100 -profile sRGB.icc original.jpg)

Red:
mean jpg: 106.595 (0.418019)
mean png: 106.582 (0.417968)
mean tif: 106.582(0.417968)
Green:
mean jpg: 128.429 (0.503641)
mean png: 128.419 (0.503603)
mean tif: 128.419 (0.503603)
Blue:
mean jpg: 113.996 (0.447042)
mean png: 114.06 (0.447296)
mean tif: 114.06 (0.447296)
Image statistics:
mean jpg: 116.34 (0.456234)
mean png: 87.2653 (0.342217)
mean tif: 87.2653 (0.342217)

So there is still one element i don't get about the png conversion being lighter in my case.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: brightness issue converting from tif to png

Post by snibgo »

What does "1920>" in your command do?
snibgo's IM pages: im.snibgo.com
mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede »

Sorry i had a typo in my command:

convert original.tif -thumbnail 1920> -quality 100 -profile sRGB.icc original.png
convert original.tif -thumbnail 1920> -quality 100 -profile sRGB.icc original.tif
convert original.tif -thumbnail 1920> -quality 100 -profile sRGB.icc original.jpg
mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede »

Small up to see if anyone can help me with my issue :D
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: brightness issue converting from tif to png

Post by snibgo »

I'm not sure what problem you need to solve.

It seems you have used IM to create tif and png files, both sRGB, with embedded profiles, that have identical values in their channels. Correct?

But some software (you haven't said what) displays the png lighter than the tif. Correct?

If that is correct, then you might create small versions of the files, say less than 10MB, so I can download and test.
snibgo's IM pages: im.snibgo.com
Post Reply