This is a clone of https://bugs.gentoo.org/show_bug.cgi?id=466798 Saving a file into png format from `showfoto` (part of digikam) fails with error "libpng error: profile 'icc': 1B0Ah: invalid length" It was working with libpng:1.5 From the debug log: >usr>src$ showfoto Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated. "/org/freedesktop/UDisks2/drives/SAMSUNG_SSD_830_Series_S0XYNEAC664966" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/WDC_WD1002FAEX_00Y9A0_WD_WCAW30075681" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/WDC_WD1002FAEX_00Y9A0_WD_WCAW30058295" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/Generic_Ultra_HS_SD_2fMMC_000000264001" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/Kindle_Internal_Storage_B0241502243506JP" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/ASUS____DRW_24B3LT_B4D0CL324524" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/SAMSUNG_SSD_830_Series_S0XXNEAC626599" : property "Drive" does not exist showfoto(25572)/digikam (core) Digikam::ThumbnailCreator::createThumbnail: Cannot create thumbnail for "/home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-k19287.digikamtempfile.png" showfoto(25572)/digikam (core) Digikam::ThumbnailCreator::load: Thumbnail is null for "/home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-k19287.digikamtempfile.png" showfoto(25572)/digikam (core) Digikam::ThumbnailCreator::createThumbnail: Cannot create thumbnail for "/home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-Ly7331.digikamtempfile.png" showfoto(25572)/digikam (core) Digikam::ThumbnailCreator::load: Thumbnail is null for "/home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-Ly7331.digikamtempfile.png" showfoto(25572)/digikam (core) Digikam::FileSaveOptionsBox::discoverFormat: Using fallback format 0 showfoto(25572)/digikam (core) Digikam::FileSaveOptionsBox::discoverFormat: Using fallback format 0 showfoto(25572)/digikam (core) Digikam::FileSaveOptionsBox::discoverFormat: Using fallback format 0 libpng error: profile 'icc': 1B0Ah: invalid length showfoto(25572)/digikam (core) Digikam::EditorCore::slotImageSaved: error saving image ' /home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-w25572.digikamtempfile.png Note, things have been compiled with gcc-4.8.0 (!).
I plan to look at this next weekend 4/5-05/2013
after some research seem libpng cannot handle srgb-d65.icm from libkdcraw
From the Gentoo bug report: --- Comment #8 from John Bowler <jbowler##acm.org> --- ICC profiles are required to have a length which is a multiple of 4, so the profile in question is broken. (See 7.1.2(c) in the spec and "NOTE 1" that follows it then read 7.2.2 - the length includes the pad bytes.) I believe there was (and maybe is) an app that was writing text strings at the end of the profile and, if the text string was not a multiple of 4 in length, it would produce a bad profile. Those profiles are easy to fix - just pad the string with \0 - but other bugs where the profile length is calculated wrong may result in serious errors. (libpng does go on to validate the length, but when the length is detectably broken at the start it simply rejects the profile.) This is a benign error on read and the profile will be ignored (along with any other colorspace information in the PNG) but on write it gets converted into an application error - we don't want to write PNGs with detectably broken profiles, something else may crash! The KDE upstream need to fix the profile, it should be easy.
krita in calligra also has some
Created attachment 79736 [details] srgb-d65.icm this profile has been padded with 0 to 6924 bytes (with okteta hex editor) and the header updated to the new size.
every upstream software (libpng and lcms) confirmed that icc profiles are padded to 4 byte and that the software involved is conformat since a looong time. so it's ok to simply replace the original profile with a padded one.
Git commit ca2274e40d065e12123f6d32db3c6fe153e621a2 by Francesco Riosa. Committed on 09/05/2013 at 18:41. Pushed by riosa into branch 'master'. ICC profiles should be padded to 4 bytes In practice with libpng >= 1.6 the profile cannot be embedded if it has the wrong size thus preventing digikam/showfoto to write png files at all. see also M +- -- profiles/srgb-d65.icm http://commits.kde.org/libkdcraw/ca2274e40d065e12123f6d32db3c6fe153e621a2
Git commit 92a57e163222ef9ee072964eb5cad92d9567a24d by Francesco Riosa. Committed on 09/05/2013 at 18:41. Pushed by riosa into branch 'KDE/4.10'. ICC profiles should be padded to 4 bytes In practice with libpng >= 1.6 the profile cannot be embedded if it has the wrong size thus preventing digikam/showfoto to write png files at all. see also M +- -- profiles/srgb-d65.icm http://commits.kde.org/libkdcraw/92a57e163222ef9ee072964eb5cad92d9567a24d