Bug 425746 - No thumbnails when importing photos from camera
Summary: No thumbnails when importing photos from camera
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Import-MainView (show other bugs)
Version: 6.4.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-24 14:23 UTC by Sergio
Modified: 2020-12-13 19:38 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.2.0


Attachments
Screenshot (156.81 KB, image/png)
2020-08-25 19:20 UTC, Sergio
Details
debug output (49.86 KB, text/plain)
2020-08-25 23:35 UTC, Sergio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio 2020-08-24 14:23:18 UTC
SUMMARY


STEPS TO REPRODUCE
1. Open import dialog
2. Let digikam read files from camera

OBSERVED RESULT

The grid with file names and creation date but with no thumbnails.

EXPECTED RESULT

The same grid but with thumbnails.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian testing
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 5.14

ADDITIONAL INFORMATION

The camera is a Nikon D300. It used to work but it started to fail some releases ago not sure when.
Comment 1 Maik Qualmann 2020-08-24 15:33:05 UTC
I've never seen the problem here before. I also have a Nikon and use it via GPhoto2 connection. Don't even see a generic icon? Is the digiKam version provided by Debian? Please test the digiKam-7.0.0 AppImage whether the problem can be reproduced.

Maik
Comment 2 Sergio 2020-08-25 13:30:03 UTC
(In reply to Maik Qualmann from comment #1)
> I've never seen the problem here before. I also have a Nikon and use it via
> GPhoto2 connection. Don't even see a generic icon? Is the digiKam version
> provided by Debian? Please test the digiKam-7.0.0 AppImage whether the
> problem can be reproduced.

No generic icon either, just a gray square. I'll check the 7.0 appimage
Comment 3 Sergio 2020-08-25 18:15:02 UTC
(In reply to Maik Qualmann from comment #1)
> I've never seen the problem here before. I also have a Nikon and use it via
> GPhoto2 connection. Don't even see a generic icon? Is the digiKam version
> provided by Debian? Please test the digiKam-7.0.0 AppImage whether the
> problem can be reproduced.

I've tried with 7.0 appimage. I can see the generic icon there but no thumbnail at all.
Comment 4 Sergio 2020-08-25 19:20:27 UTC
Created attachment 131181 [details]
Screenshot

This is what I see
Comment 5 Maik Qualmann 2020-08-25 20:40:15 UTC
Is the camera connected via USB cable (GPhoto2 driver) or is the SD card in a card reader? Debug output may help us if you start digiKam in a terminal.

Maik
Comment 6 Sergio 2020-08-25 23:26:24 UTC
(In reply to Maik Qualmann from comment #5)
> Is the camera connected via USB cable (GPhoto2 driver) or is the SD card in
> a card reader? Debug output may help us if you start digiKam in a terminal.

Yeah, usb cable. I'll try to get some debug output.
Comment 7 Sergio 2020-08-25 23:35:59 UTC
Created attachment 131187 [details]
debug output
Comment 8 Maik Qualmann 2020-08-26 19:19:04 UTC
No error message in the log. If you display the history with Ctrl + H, do you see error messages? When trying to import images from a card reader / folder, are thumbnails shown?

Maik
Comment 9 Sergio 2020-08-27 09:13:39 UTC
(In reply to Maik Qualmann from comment #8)
> No error message in the log. If you display the history with Ctrl + H, do
> you see error messages? When trying to import images from a card reader /
> folder, are thumbnails shown?

No errors either in the history.

Regarding the second question that's interesting. Importing RAWs from a local folder works fine. Importing from an external hard drive works fine.

In all those cases I see in the logs:
digikam.rawengine: Preview data size: 837944
digikam.rawengine: Using embedded RAW preview extraction

but not when importing from the camera. BTW I always shoot RAW but I did some RAW+JPEG experiments with the camera in the past. For those pictures, the JPEG is properly shown but the RAW is not.
Comment 10 caulier.gilles 2020-08-27 09:19:28 UTC
>but not when importing from the camera. BTW I always shoot RAW but I did some >RAW+JPEG experiments with the camera in the past. For those pictures, the JPEG >is properly shown but the RAW is not.

This behaviour is normal and know. libgphoto2 driver is able to extract Exif from JPEG, but not from RAW.

When you import SD card by a stand alone reader and not from camera, digiKam do not use a camera driver, it read directly files from the medium, and digiKam use libraw to extract Exif.

So, always use a card reader to drop this libgphoto2 limitation. If you want to see the libgphoto2 driver working with RAW files as JPEG, report this problem as UPSTREAM bug to Gphoto2 project.

Gilles Caulier

Note: to increase download speed and safe camera battery, i always use a card reader here (Sony camera)
Comment 11 Sergio 2020-08-27 09:31:39 UTC
(In reply to caulier.gilles from comment #10)
> >but not when importing from the camera. BTW I always shoot RAW but I did some >RAW+JPEG experiments with the camera in the past. For those pictures, the JPEG >is properly shown but the RAW is not.
> 
> This behaviour is normal and know. libgphoto2 driver is able to extract Exif
> from JPEG, but not from RAW.
> 
> When you import SD card by a stand alone reader and not from camera, digiKam
> do not use a camera driver, it read directly files from the medium, and
> digiKam use libraw to extract Exif.
> 
> So, always use a card reader to drop this libgphoto2 limitation. If you want
> to see the libgphoto2 driver working with RAW files as JPEG, report this
> problem as UPSTREAM bug to Gphoto2 project.
> 
> Gilles Caulier
> 
> Note: to increase download speed and safe camera battery, i always use a
> card reader here (Sony camera)

All this seems sensible but the fact is that I have never used a card reader to extract photos from the camera and I have always been able to see the thumbnails before importing from the camera until recently.
Comment 12 caulier.gilles 2020-08-27 09:33:11 UTC
Including RAW files ? aka NEF for Nikon camera...

Gilles Caulier
Comment 13 caulier.gilles 2020-08-27 09:35:19 UTC
With your Nikon camera which protocol do you use : MTP or PTP ?

Check camera settings.

Gilles Caulier
Comment 14 Sergio 2020-08-27 09:48:16 UTC
(In reply to caulier.gilles from comment #13)
> With your Nikon camera which protocol do you use : MTP or PTP ?
> 
> Check camera settings.

So Nikon has either Mass Storage or MTP/PTP. I always have it in MTP/PTP mode. If I select Mass Storage then I get the previews as if it were another external drive, but it does not work when MTP/PTP mode is selected.

I *think* I have been always using MTP/PTP mainly because it has been always working fine with darktable (I switched to digikam for digital assess management although not for editing). And IIRC darktable also uses libgphoto2 and libraw.

Maybe it never worked and the thing was that I switched from mass storage to MTP/PTP recently but I don't remember changing it.
Comment 15 caulier.gilles 2020-08-27 09:50:35 UTC
>And IIRC darktable also uses libgphoto2 and libraw.

No, darktable do not use libraw but rawspeed API, as i know.

Gilles Caulier
Comment 16 Sergio 2020-08-27 09:55:38 UTC
(In reply to caulier.gilles from comment #15)
> >And IIRC darktable also uses libgphoto2 and libraw.
> 
> No, darktable do not use libraw but rawspeed API, as i know.

That's right. But anyway I think it's using libgphoto2 as digikam does to talk to the camera...
Comment 17 Maik Qualmann 2020-08-27 15:13:10 UTC
On my Nikon D5300, RAW files are displayed with thumbnails in PTP / MTP mode. Can you upload a test RAW image of your D300 to a file service?

Maik
Comment 18 Sergio 2020-08-27 16:23:11 UTC
(In reply to Maik Qualmann from comment #17)
> On my Nikon D5300, RAW files are displayed with thumbnails in PTP / MTP
> mode. Can you upload a test RAW image of your D300 to a file service?
> 
> Maik

Here you are https://sendgb.com/h4gL1dsBPoW
Comment 19 Maik Qualmann 2020-08-27 19:57:22 UTC
Thanks for the RAW file. When I copy the file to my memory card and connect my camera via PTP/MTP, a thumbnail is displayed in digiKam. As the thumbnail is created by the device with the PTP/MTP protocol, either your D300 camera cannot do this for RAW files or GPhoto2 makes a mistake with your camera model. Firmware updated from the camera? Maybe reset the camera to the factory settings?

Maik
Comment 20 Sergio 2020-08-27 20:16:28 UTC
(In reply to Maik Qualmann from comment #19)
> Thanks for the RAW file. When I copy the file to my memory card and connect
> my camera via PTP/MTP, a thumbnail is displayed in digiKam. As the thumbnail
> is created by the device with the PTP/MTP protocol, either your D300 camera
> cannot do this for RAW files or GPhoto2 makes a mistake with your camera
> model. Firmware updated from the camera? Maybe reset the camera to the
> factory settings?

As mentioned before, this was working before, it isn't something that never worked. Also, when importing with other software which is using gphoto2 as well as darktable, I can perfectly see the thumbnails.

I did another test. I used the gphoto2 cli to get the thumbnails of several RAWs directly from my camera using 

$gphoto2 -t 330-335

I got the thumbnails from all of them with no issues, so I think we can discard that the problem is in libgphoto2
Comment 21 Maik Qualmann 2020-08-28 06:06:40 UTC
*** Bug 425878 has been marked as a duplicate of this bug. ***
Comment 22 Sergio 2020-08-31 15:59:40 UTC
Just let me know if you need additional data to address the issue.
Comment 23 Maik Qualmann 2020-08-31 19:30:55 UTC
I don't see any bug in the code at the moment. We convert the RAW-data thumbnails received from GPhoto2, with a function of QImage, into an image. If this didn't work, we would have a NULL image and a corresponding error message in the history. So why no thumbnail is displayed with you, I can't say at the moment. After the release of digiKam-7.1.0 I will add additional debug output for testing.

Maik
Comment 24 Sergio 2020-12-11 20:37:01 UTC
(In reply to Maik Qualmann from comment #23)
> I don't see any bug in the code at the moment. We convert the RAW-data
> thumbnails received from GPhoto2, with a function of QImage, into an image.
> If this didn't work, we would have a NULL image and a corresponding error
> message in the history. So why no thumbnail is displayed with you, I can't
> say at the moment. After the release of digiKam-7.1.0 I will add additional
> debug output for testing.

I've just updated to 7.1.0 and the issue is still there indeed. Waiting for the additional logging.
Comment 25 Maik Qualmann 2020-12-11 20:47:13 UTC
Have you already tested the AppImage to rule out a problem with the Debian package?

Maik
Comment 26 Sergio 2020-12-11 22:19:06 UTC
(In reply to Maik Qualmann from comment #25)
> Have you already tested the AppImage to rule out a problem with the Debian
> package?
> 

Yep.

Some more info. If I do $ gpthoto2 --get-thumbail=1 a JPG is properly generated. 

I've an update BTW, if I select in the camera the "Mass Storage" mode instead of the MTP/PTP then the thumbnails are properly generated.
Comment 27 Maik Qualmann 2020-12-12 21:32:53 UTC
Git commit a80afb715709778fa0049288520a08874afe2976 by Maik Qualmann.
Committed on 12/12/2020 at 21:31.
Pushed by mqualmann into branch 'master'.

camera capture preview support or preview size is no indicator for thumbnails are possible
FIXED-IN: 7.2.0

M  +2    -1    NEWS
M  +1    -1    core/utilities/import/backend/gpcamera.cpp
M  +1    -1    core/utilities/import/models/importthumbnailmodel.cpp

https://invent.kde.org/graphics/digikam/commit/a80afb715709778fa0049288520a08874afe2976
Comment 28 Sergio 2020-12-13 19:38:37 UTC
(In reply to Maik Qualmann from comment #27)
> Git commit a80afb715709778fa0049288520a08874afe2976 by Maik Qualmann.
> Committed on 12/12/2020 at 21:31.
> Pushed by mqualmann into branch 'master'.
> 
> camera capture preview support or preview size is no indicator for
> thumbnails are possible
> FIXED-IN: 7.2.0
> 
> M  +2    -1    NEWS
> M  +1    -1    core/utilities/import/backend/gpcamera.cpp
> M  +1    -1    core/utilities/import/models/importthumbnailmodel.cpp
> 
> https://invent.kde.org/graphics/digikam/commit/
> a80afb715709778fa0049288520a08874afe2976

I've just built master with this fix and I can confirm it works fine now. Thanks!