Project

General

Profile

Bug #12273

PNG export produces a checksum mismatch in the iCCP chunk

Added by Simon Raffeiner 3 months ago. Updated 3 months ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
General
Target version:
-
Start date:
07/26/2018
Due date:
% Done:

0%

Affected Version:
2.4.3
System:
other GNU/Linux
bitness:
64-bit
hardware architecture:
amd64/x86

Description

Steps to reproduce:
- Export to PNG

What should happen:
- No checksum errors in the PNG header chunks

What happens:
- The iCCP header (Embedded ICC profile) has a CRC mismatch. Example pngcheck output:

$ pngcheck Africa_satellite_orthographic.png
Africa_satellite_orthographic.png CRC error in chunk iCCP (computed 868f1ca7, expected 0c6c541d)

This is independent of the bit depth and the embedded color profile. An example (original file, XMP sidecar, PNG exports using BRG and sRGB color profiles) is attached. The header chunk checksums can be verified with the pngcheck tool (http://www.libpng.org/pub/png/apps/pngcheck.html)

Africa_satellite_orthographic.jpg.xmp (2.52 KB) Simon Raffeiner, 07/26/2018 01:23 PM

Africa_satellite_orthographic.jpg (535 KB) Simon Raffeiner, 07/26/2018 01:23 PM

Africa_satellite_orthographic.BRG.png (1.19 MB) Simon Raffeiner, 07/26/2018 01:24 PM

Africa_satellite_orthographic.sRGB.png (1.18 MB) Simon Raffeiner, 07/26/2018 01:24 PM

History

#1 Updated by Simon Raffeiner 3 months ago

I used libpng 1.6.34 for my tests.

#2 Updated by Simon Raffeiner 3 months ago

exiftool also gives a warning (first line):

$ exiftool Africa_satellite_orthographic.sRGB.png | grep Profile
Warning : Bad length ICC_Profile (length 2416378096)
ICC Profile : (Binary data 16866 bytes, use -b option to extract)
Profile Name : sRGB
Profile CMM Type : Little CMS
Profile Version : 2.1.0
Profile Class : Display Device Profile
Profile Connection Space : XYZ
Profile Date Time : 2018:07:26 10:19:37
Profile File Signature : acsp
Profile Creator : Little CMS
Profile ID : 0
Profile Copyright : Public Domain
Profile Description : sRGB

#3 Updated by Simon Raffeiner 3 months ago

I've noticed that cmsSaveProfileToMem(out_profile, buf, &len) in src/imageio/format/png.c:183 seems to return a different value for "len" than exiftool reports for the size of the ICC Profile later. If I export the example file to sRGB, cmsSaveProfileToMem returns len=8940, but exiftool on the output file gives me

ICC Profile : (Binary data 16868 bytes, use -b option to extract)

This seems to be true for all color spaces available in the export module, both profiles never seem to have the same size.

#4 Updated by Simon Raffeiner 3 months ago

If I open darktable, export a, close it and repeat, I apparently get output files with slightly different ICC Profile sizes despite using the same picture with the exact same settings. Here are some examples for sRGB:

ICC Profile : (Binary data 16868 bytes, use -b option to extract)
ICC Profile : (Binary data 16870 bytes, use -b option to extract)
ICC Profile : (Binary data 16870 bytes, use -b option to extract)
ICC Profile : (Binary data 16870 bytes, use -b option to extract)
ICC Profile : (Binary data 16870 bytes, use -b option to extract)
ICC Profile : (Binary data 16868 bytes, use -b option to extract)

Also available in: Atom PDF