Bug 388898 - Convert Tiff to PNG fails
Summary: Convert Tiff to PNG fails
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Bqm-Convert (show other bugs)
Version: 5.8.0
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-13 09:24 UTC by philippe.quaglia
Modified: 2019-08-10 20:55 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.0


Attachments
Capture 1: see the error mesasges (192.10 KB, image/png)
2018-01-13 09:24 UTC, philippe.quaglia
Details
Capture 2: see the empty PNG file created (987.46 KB, image/png)
2018-01-13 09:25 UTC, philippe.quaglia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description philippe.quaglia 2018-01-13 09:24:19 UTC
Created attachment 109832 [details]
Capture 1: see the error mesasges

Converting the Tiff files to PNG fails. The batch queue manager gives an error message «unable to treat the image» followed by «image successfully treated» (see capture 1). Then, a PNG file is created, but it is empty. (see capture 2). 
This bug affect the stable 5.7 release as well as the 5.8 prerealease, built the 10th of january.
Comment 1 philippe.quaglia 2018-01-13 09:25:06 UTC
Created attachment 109833 [details]
Capture 2: see the empty PNG file created
Comment 2 caulier.gilles 2018-01-13 09:34:33 UTC
can you share the tiff file than you cannot convert to png ?

can you start the appimage from a console a look the debug statements printed by BQM ?

Gilles Caulier
Comment 3 philippe.quaglia 2018-01-13 12:36:34 UTC
Here is the output of the terminal when I try to convert a file:

philippe@philippe-desktop:~/Bureau$ ./digikam-5.8.0-01-x86-64.appimage
-- digiKam AppImage Bundle
-- Use 'help' as CLI argument to know all available options
QtAV 1.12.0(Jul 20 2017, 17:39:32)
Multimedia framework base on Qt and FFmpeg.
Distributed under the terms of LGPLv2.1 or later.
Shanghai University->S3 Graphics->Deepin->PPTV, Shanghai, China 
Copyright (C) 2012-2016 Wang Bin (aka. Lucas Wang) wbsecg1@gmail.com
Donate: http://qtav.org/donate.html
Source: https://github.com/wang-bin/QtAV
Home page: http://qtav.org
capi::version: 0.6.0
Cannot connect to server socket err = Aucun fichier ou dossier de ce type
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 
4294967295, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 
4294967295, skipping unlock
QFSFileEngine::open: No file name specified
QFSFileEngine::open: No file name specified
kf5.kservice.sycoca: Parse error in 
"/home/philippe/.config/menus/applications-merged/xdg-desktop-menu-dummy.menu" 
, line  1 , col  1 :  "unexpected end of file"
The desktop entry file "/usr/share/applications/colorhug-docs.desktop"  
has Type= "Link" instead of "Application" or "Service"
kf5.kservice.sycoca: Invalid Service : 
"/usr/share/applications/colorhug-docs.desktop"
The desktop entry file 
"/usr/share/applications/unity-lens-photos.desktop" has Type= 
"Application" but no Exec line
kf5.kservice.sycoca: Invalid Service : 
"/usr/share/applications/unity-lens-photos.desktop"
The desktop entry file 
"/usr/share/applications/org.gnome.ChromeGnomeShell.desktop" has Type= 
"Application" but no Exec line
kf5.kservice.sycoca: Invalid Service : 
"/usr/share/applications/org.gnome.ChromeGnomeShell.desktop"
The desktop entry file 
"/usr/share/applications/extras-my-weather-indicator.desktop"  has Type= 
" Application"  instead of "Application" or "Service"
kf5.kservice.sycoca: Invalid Service : 
"/usr/share/applications/extras-my-weather-indicator.desktop"
QFSFileEngine::open: No file name specified
QFSFileEngine::open: No file name specified
libpng error: known incorrect sRGB profile
digikam.dimg.png: Internal libPNG error during writing file. Process 
aborted!
digikam.metaengine: Cannot load metadata from file   (Error # 11 : 
/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png: 
The file contains data of an unknown image type
digikam.dimg.png: Not a PNG image file.
digikam.dimg.qimage: Can not load " 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png" 
" using DImg::QImageLoader!
digikam.metaengine: Cannot load metadata from file   (Error # 11 : 
/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png: 
The file contains data of an unknown image type
digikam.dimg.png: Not a PNG image file.
digikam.dimg.qimage: Can not load " 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png" 
" using DImg::QImageLoader!
digikam.metaengine: Cannot load metadata from file   (Error # 11 : 
/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png: 
The file contains data of an unknown image type
digikam.dimg.png: Not a PNG image file.
digikam.dimg.qimage: Can not load " 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png" 
" using DImg::QImageLoader!
digikam.metaengine: Cannot load metadata using Exiv2   (Error # 11 : 
/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png: 
The file contains data of an unknown image type
digikam.general: Cannot create thumbnail for 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png"
digikam.general: Thumbnail is null for 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png"
digikam.metaengine: Cannot load metadata from file   (Error # 11 : 
/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png: 
The file contains data of an unknown image type
digikam.dimg.png: Not a PNG image file.
digikam.dimg.qimage: Can not load " 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png" 
" using DImg::QImageLoader!
digikam.metaengine: Cannot load metadata using Exiv2   (Error # 11 : 
/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png: 
The file contains data of an unknown image type
digikam.general: Cannot create thumbnail for 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png"
digikam.general: Thumbnail is null for 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png"
digikam.metaengine: Cannot load metadata from file   (Error # 11 : 
/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png: 
The file contains data of an unknown image type
digikam.dimg.png: Not a PNG image file.
digikam.dimg.qimage: Can not load " 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png" 
" using DImg::QImageLoader!
digikam.metaengine: Cannot load metadata using Exiv2   (Error # 11 : 
/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png: 
The file contains data of an unknown image type
digikam.general: Cannot create thumbnail for 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png"
digikam.general: Thumbnail is null for 
"/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png"

Regards.


Le 13/01/2018 à 10:34, bugzilla_noreply@kde.org a écrit :
> https://bugs.kde.org/show_bug.cgi?id=388898
>
> caulier.gilles@gmail.com changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |caulier.gilles@gmail.com
>
> --- Comment #2 from caulier.gilles@gmail.com ---
> can you share the tiff file than you cannot convert to png ?
>
> can you start the appimage from a console a look the debug statements printed
> by BQM ?
>
> Gilles Caulier
>
Comment 4 caulier.gilles 2018-01-13 13:16:52 UTC
I can see 2 problems here :

digikam.dimg.png: Internal libPNG error during writing file. Process
aborted!
digikam.metaengine: Cannot load metadata from file   (Error # 11 :
/mnt/2f05e4b1-d13b-445d-8c36-93703587c231/Photos_scans/Neg_Couleur/1999_ete/199907_021.png:
The file contains data of an unknown image type
digikam.dimg.png: Not a PNG image file.

this one, libpng cannot write the PNG file. It's clear : it's a low level problem with this shared lib, perhaps due to a failure when tiff file is load previously before to convert to PNG.

The second problem is about BQM which report no error at end when an error is occurred just before (and BQM has seen this error as it's logged in journal view)

Gilles Caulier
Comment 5 caulier.gilles 2018-01-13 13:18:26 UTC
Again, if you can share some tiff files that you want to convert to PNG, i can try to reproduce the problem in debug mode.

Gilles Caulier
Comment 6 philippe.quaglia 2018-01-13 18:14:24 UTC
Hello Gilles

it is a big file, here is a link to download it: 
https://cloud.indie.host/s/fU2sAnjmeIBOHkZ

I tried to resize it with Gimp, but the resized imaged is then converted 
to PNG without any problem. So Gimp does something that fix the problem 
with the library.

Best regards.


Le 13/01/2018 à 14:18, bugzilla_noreply@kde.org a écrit :
> https://bugs.kde.org/show_bug.cgi?id=388898
>
> --- Comment #5 from caulier.gilles@gmail.com ---
> Again, if you can share some tiff files that you want to convert to PNG, i can
> try to reproduce the problem in debug mode.
>
> Gilles Caulier
>
Comment 7 caulier.gilles 2018-01-13 19:17:52 UTC
First the tiff file can be open with DK image editor. I use official 5.8.0 Linux AppImage bundle, just to be sure.

So, there is no problem with the tiff file to load in memory. BQM and Image Editor use the same framework in background to play with image data.

Gilles Caulier
Comment 8 caulier.gilles 2018-01-13 19:18:49 UTC
I can convert the TIFF file to PNG with 5.8.0 Appimage into Image Editor. No problem here with libpng in fact, included in the bundle.

Gilles Caulier
Comment 9 caulier.gilles 2018-01-13 19:20:37 UTC
The dysfunction is fully reproducible here with BQM from 5.8.0 AppImage. So the problem is localized in BQM files manager or something like that.

Gilles Caulier
Comment 10 caulier.gilles 2018-01-13 19:24:34 UTC
Just to be sure, i tried to convert the TIFF to JPEG into BQM. All work fine as expected. So the problem is only with PNG converter. Very strange...

Gilles Caulier
Comment 11 caulier.gilles 2018-01-13 19:26:51 UTC
I tried to convert this TIFF file to PNG using native digiKam 5.8.0 installed on computer. The problem still reproducible. So it's not a packaging problem with AppImage bundle. The problem is really in BQM implementation.

Gilles Caulier
Comment 12 Maik Qualmann 2018-01-13 21:35:44 UTC
I see this error message in BQM:

digikam.dimg: Saving to  "/daten/Bilder/Zugang/xx/BatchTool-fltmRu-2b5179bd.digikamtempfile.png"  with format:  "PNG"
libpng error: known incorrect sRGB profile
digikam.dimg.png: Internal libPNG error during writing file. Process aborted!

And this in the image editor (but saved as PNG):

libpng warning: iCCP: profile 'ICC PROFILE': 58070020h: exceeds application limits
libpng warning: iCCP: CRC error


Maik
Comment 13 caulier.gilles 2018-01-14 01:47:36 UTC
Maik, is right. Your ICC color profile break the libpng in background while integrating it to the dedicated PNG chunk.

But the question is : why BQM has a problem to run conversion from tiff to png, and editor no ?

Gilles Caulier
Comment 14 caulier.gilles 2018-01-14 01:48:23 UTC
Philipe, cab you confirm that you can covert this TIFF to PNG under Image editor ?

Gilles Caulize
Comment 15 Maik Qualmann 2018-01-14 07:09:28 UTC
Saving as PNG in the image editor also fails because the color management is disabled. So we do not seem to use color management in BQM.

Maik
Comment 16 caulier.gilles 2018-01-14 08:01:31 UTC
Ah right.

And for me CM is enabled and editor can convert tiff to png properly...

Gilles
Comment 17 philippe.quaglia 2018-01-14 11:16:25 UTC
Hello Gilles

yes, I confirm there is no problem when converting the same Tiff file to 
PNG with the image editor (I did not knew before that it was possible to 
do that with the image editor).

Best regards.


Le 14/01/2018 à 02:48, bugzilla_noreply@kde.org a écrit :
> https://bugs.kde.org/show_bug.cgi?id=388898
>
> --- Comment #14 from caulier.gilles@gmail.com ---
> Philipe, cab you confirm that you can covert this TIFF to PNG under Image
> editor ?
>
> Gilles Caulize
>
Comment 18 caulier.gilles 2018-01-14 11:28:03 UTC
yes, Image Editor and BQM share the same internal framework to play with image data. Code is factorized.

Did you confirm also than converting TIFF to JPEG in BQM work for you ?

Gilles Caulier
Comment 19 Maik Qualmann 2018-01-14 11:42:50 UTC
LibPNG 1.6 has added stricter controls on the color profile. The color profile in the TIFF image is incorrect for LibPNG. Add the ICC conversion at the beginning of your BQM tools and select, for example, an sRGB profile. Now the conversion does not fail anymore.

Maik
Comment 20 caulier.gilles 2018-08-28 14:04:44 UTC
Philippe,

Any feedback about this file ?

Didi you read the last comment from Maik ?

Gilles Caulier
Comment 21 philippe.quaglia 2018-09-15 09:31:09 UTC
Hello, I confirm that it works well if I add ICC conversion at the beginning of your BQM tools as suggested by Maik. 
However, I think that the bug is confusing for users of Digikam.  May be there should be an explicit error message (ICC error during the conversion, try adding ICC conversion) ? Or always proposing ICC conversion when ones want to convert Tiff files ?
Comment 22 Maik Qualmann 2019-08-10 20:55:37 UTC
Git commit 2ddf14f092fcbd8722a5c2f1b01227ee7b851038 by Maik Qualmann.
Committed on 10/08/2019 at 20:53.
Pushed by mqualmann into branch 'master'.

add a note to the BQM-PNG tool to convert the color profile beforehand
Related: bug 410796
FIXED-IN: 6.3.0

M  +3    -1    NEWS
M  +15   -3    core/dplugins/bqm/convert/converttopng/converttopng.cpp

https://invent.kde.org/kde/digikam/commit/2ddf14f092fcbd8722a5c2f1b01227ee7b851038