SUMMARY I wanted to extract the faces thumbnails with the SQL code below, parsed and piped to magic for crop and resize based on image tag properties. With the thumbs in external JPG files, I noticed about 10% of them were wrong, not showing the face, but another part of the image. Both images with faces detected automatically and manually suffered with the issue, even thou auto recognized images were about 90% of the total images with the issue. The total images I looked into is about 3300. STEPS TO REPRODUCE 1. Rotate the affected images left/right 2. The image thumb shows erratic behavior, rotating in random direction (same as image, opposite, or completely upside down) 3. The thumb blinks and then rotates correctly 4. The image always rotates correctly. The boxes around faces are always correct OBSERVED RESULT Wrong face thumbs extracted from some images. Some image data sown below. EXPECTED RESULT SOFTWARE/OS VERSIONS Windows: 10.0.19041 macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION SQL code used to extract the face thumbs: ATTACH 'E:\digiKam\digikam4.db' as ddk; ATTACH 'E:\digiKam\thumbnails-digikam.db' as dtn; SELECT tar.specificPath||ta.relativePath,ti.name,titp.imageid,titp.value FROM ddk.Albums AS ta, ddk.AlbumRoots AS tar, ddk.ImageTagProperties AS titp, ddk.Images AS ti WHERE ta.id=ti.album and tar.id=ta.albumRoot and ti.id=titp.imageid and titp.property='tagRegion' and titp.tagid IN ( SELECT id FROM ddk.Tags WHERE name='XXX' ) ORDER BY ti.name ; DETACH DATABASE ddk; DETACH DATABASE dtn; Sample image data, before and after the fix: digiKam.db Tags with person name -> id=89 Images name="2007-11-02 13h26 663" -> id=26236 ImageTagProperties imageid=26236 and tagid=89 -> property=<rect x="1181" y="1038" width="192" height="251"/> After fix (rotate back and forth 90 degrees) property=<rect x="1181" y="1038" width="192" height="251"/>
It still reproducible using current 7.2.0-betaé installer for Windows ? https://files.kde.org/digikam/ Gilles Caulier
I don't know if his problem is he is extracting an invalid / old face thumbnail. Or whether it is the bug that if there is a facial thumbnail already with the coordinates, no new and correct one is created. The face thumbnail in the DB is found using a path + rectangle identifier. Maik
(In reply to Maik Qualmann from comment #2) > I don't know if his problem is he is extracting an invalid / old face > thumbnail. Or whether it is the bug that if there is a facial thumbnail > already with the coordinates, no new and correct one is created. The face > thumbnail in the DB is found using a path + rectangle identifier. > > Maik I am not getting the thumbs from the DB (could not fathom how...). I am getting the image paths and using ImageMagic to extract the rectangle indicated by the coordinates in ImageTagProperties. /Roberto
But that's not a bug in digiKam. You have to understand that digiKam always stores the face coordinates internally with the aligned image. When writing metadata to the image, as is the standard in many programs, the face coordinates for the unaligned image are then saved. So you have to read the orientation flag in the DB and rotate the image accordingly with ImageMagick. Maik
(In reply to Maik Qualmann from comment #4) > But that's not a bug in digiKam. You have to understand that digiKam always > stores the face coordinates internally with the aligned image. When writing > metadata to the image, as is the standard in many programs, the face > coordinates for the unaligned image are then saved. So you have to read the > orientation flag in the DB and rotate the image accordingly with ImageMagick. > > Maik All cases are fixed after I rotate the images back and forth and extract the thumbs again, without changing any option in ImageMagic...
If you rotate the images back and forth in digiKam, they are actually rotated losslessly depending on the setting in digiKam setup and the orientation flag is then "normal". It is clear that the face coordinates then match the image. Maik
Hummm... You mean I indirectly "fixed" the face coordinates so it matches the image and creating the thumbs in ImageMagick now works? Intriguing only a (comparably) few images are affected. Also intriguing the behavior in digiKam when you rotate the image back and forth and the thumbnail flips in random directions first before rotation according to the image... It doesn't occur with "the correct" images. On 2020-11-12 16:29, Maik Qualmann wrote: > https://bugs.kde.org/show_bug.cgi?id=429021 > > Maik Qualmann <metzpinguin@gmail.com> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|REPORTED |RESOLVED > Resolution|--- |NOT A BUG > Version Fixed In| |7.2.0 > > --- Comment #6 from Maik Qualmann <metzpinguin@gmail.com> --- > If you rotate the images back and forth in digiKam, they are actually rotated > losslessly depending on the setting in digiKam setup and the orientation flag > is then "normal". It is clear that the face coordinates then match the image. > > Maik > /Roberto
(In reply to Beto Kella from comment #7) > Hummm... You mean I indirectly "fixed" the face coordinates so it > matches the image and creating the thumbs in ImageMagick now works? > Intriguing only a (comparably) few images are affected. Also intriguing > the behavior in digiKam when you rotate the image back and forth and the > thumbnail flips in random directions first before rotation according to > the image... It doesn't occur with "the correct" images. > > On 2020-11-12 16:29, Maik Qualmann wrote: > > https://bugs.kde.org/show_bug.cgi?id=429021 > > > > Maik Qualmann <metzpinguin@gmail.com> changed: > > > > What |Removed |Added > > ---------------------------------------------------------------------------- > > Status|REPORTED |RESOLVED > > Resolution|--- |NOT A BUG > > Version Fixed In| |7.2.0 > > > > --- Comment #6 from Maik Qualmann <metzpinguin@gmail.com> --- > > If you rotate the images back and forth in digiKam, they are actually rotated > > losslessly depending on the setting in digiKam setup and the orientation flag > > is then "normal". It is clear that the face coordinates then match the image. > > > > Maik > > > > /Roberto Adding -auto-orient option to ImageMagic did the trick. Sorry for opening as a bug in digiKam. The behavior described above created bias.