Bug 234546

Summary: Preview fails for some images [patch]
Product: [Applications] digikam Reporter: Zen <cerebralpandemics>
Component: Preview-ImageAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, info, metzpinguin
Priority: NOR    
Version: 2.7.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.0
Sentry Crash Report:
Attachments: sample image
imageLoader.patch
imageLoader2.patch

Description Zen 2010-04-16 17:37:43 UTC
Version:           1.2.0 (using KDE 4.4.2)
OS:                Linux
Installed from:    openSUSE RPMs

For some image files the preview fails with the message "Cannot display preview for [file]". The very same images load fine in other apps (eg Gwenview).
Comment 1 Zen 2010-04-16 17:39:45 UTC
Created attachment 42824 [details]
sample image

Sample image which displays fine in Gwenview but fails to load in DigiKam.
Comment 2 Johannes Wienke 2010-04-16 17:43:34 UTC
Please enable all debugging for digikam in kdedebugdialog, run digikam in the console, try to load such an image and paste the console output here.
Comment 3 Zen 2010-04-16 17:51:21 UTC
By uploading that sample file here I just realized that it is indeed a png wrongly named .jpg - renaming it to .png solves the issue. Maybe you could look into loading such files anyway or even offering to rename them? Otherwise consider this solved.
Comment 4 caulier.gilles 2011-12-12 20:29:03 UTC
Zen,

This file still valid with 2.x series ?

Gilles Caulier
Comment 5 caulier.gilles 2012-06-26 14:57:02 UTC
This file still valid using last 2.6.0 release ?

Gilles Caulier
Comment 6 Mike Gutzschhahn 2012-07-25 14:23:05 UTC
Same problem here with Digikam 2.7 under OpenSuse 12.1 but only with TIFF files without a single exception (+8000 images).
Comment 7 caulier.gilles 2014-08-29 21:39:26 UTC
Reproducible with digiKam 4.2.0. Image cannot be loaded in digiKam...

Gilles Caulier
Comment 8 Maik Qualmann 2016-02-12 19:33:05 UTC
Created attachment 97166 [details]
imageLoader.patch

When image loading fails with a default loader and the query was not been canceled, we use the QImage loader. The QImage loader now uses only the file content for the format detection.

Maik
Comment 9 Maik Qualmann 2016-02-12 19:50:08 UTC
Created attachment 97167 [details]
imageLoader2.patch

Fix compile warning.

Maik
Comment 10 caulier.gilles 2016-02-13 09:30:06 UTC
Patch is fine for me. Tested with sample provided on this bug entry

Gilles
Comment 11 Maik Qualmann 2016-02-13 15:39:36 UTC
Git commit 77876ae91081a88fb6b766403f05a03ca519173b by Maik Qualmann.
Committed on 13/02/2016 at 15:38.
Pushed by mqualmann into branch 'master'.

try QImage loader when default image loader fails
FIXED-IN: 5.0.0

M  +2    -1    NEWS
M  +14   -13   libs/dimg/dimg.cpp
M  +5    -1    libs/dimg/loaders/qimageloader.cpp

http://commits.kde.org/digikam/77876ae91081a88fb6b766403f05a03ca519173b