Bug 424441

Summary: detect defective pictures
Product: [Applications] digikam Reporter: Daniel <daniel-other+kdebug>
Component: Maintenance-QualityAssignee: Digikam Developers <digikam-bugs-null>
Status: REPORTED ---    
Severity: wishlist CC: caulier.gilles, frederic.chaume
Priority: NOR    
Version: 7.1.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Daniel 2020-07-19 22:11:40 UTC
SUMMARY
It would be nice if digikam could show a list of possible defective pictures. Some defective pictures can be identified using the logging output of digikam. A picture is defective, if it has size 0byte, a hard edge in it or color defects (missing data). This would be nice because it would show early signs of a failing hard disk (and make the user apparent that they should always have a backup).

ADDITIONAL INFORMATION
I am not sure how such defective pictures can be detected easily, but I have noticed that I have a bunch of them in my collection AFTER initial import into digikam (due to possible hard disk failure, corruption when copying, force-shutting digikam, I don't know)
Comment 1 fch22 2023-05-15 16:33:37 UTC
I found an option using exiv2 under windows that can highligth corrupted image, if it can help

>bin\exiv2.exe -pp -q P2280067_DxO-corrupted.jpg
Exiv2 exception in print action for file P2280067_DxO-corrupted.jpg:
P2280067_DxO-corrupted.jpg: The file contains data of an unknown image type

>bin\exiv2.exe -pp -q P2280067_DxO.jpg
Preview 1: image/jpeg, 317x237 pixels, 17356 bytes

>bin\exiv2.exe -pp -q .\P2280067.ORF
Preview 1: image/jpeg, 160x120 pixels, 9080 bytes
Preview 2: image/jpeg, 3200x2400 pixels, 1060974 bytes

I think that could be a good solution to find corrupted jpeg. Based on this I have some thought
- as exiv2 is native with Digikam, I guess such error could be visible? Is there some "debug level" or some logs somewhere that could report such errors ?
- I'm not expert on coding so don't know how to translate such command to a recursive search on a set of folders?
- seems to apply to raw also , but I don't have corrupted raw to perform the test
Comment 2 caulier.gilles 2023-12-01 11:45:16 UTC
Maik,

A possible way is to see if the image data is null or not. See my comment here :

https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/imgqsort/imagequalityparser.cpp?ref_type=heads#L63

Gilles
Comment 3 caulier.gilles 2023-12-01 11:46:03 UTC
Daniel,

The Exiv2 exception is also generated if the file format is not recognized by the library. It cannot be used for this task.

Gilles Caulier