Component to preview files in a directory

Ask about the individual Gambas components here.
01McAc
Posts: 67
Joined: Sunday 24th January 2021 8:25pm

Re: Component to preview files in a directory

Post by 01McAc » Monday 29th March 2021 2:15pm

OK, downloaded your example and works. One change I had to do though. I needed to change the libraw version since I run Fedora rawhide and it obviously uses a different version:
Library "libraw:20"
After this little change your example works as expected.
But - and it seems there is always a 'but' - when I try to get a thumbnail from my DNG's it generates a zero byte jpg. At first I thought it is a timing problem and put a
Wait
after the line
intReply = libraw_dcraw_thumb_writer(pPoint, strThumbNail)
It still generates an empty jpg file.
I have been thinking about it and came to the conclusion that my DNG's don't have any embedded jpg as I am shooting raw only. libraw tries to extract the jpg and exiftool generates thumbnail out of the DNG I guess.
Nevertheless, it was a good exercise for me to get into the world of external libraries.

User avatar
stevedee
Posts: 455
Joined: Monday 20th March 2017 6:06pm

Re: Component to preview files in a directory

Post by stevedee » Monday 29th March 2021 4:58pm

01McAc wrote:
Monday 29th March 2021 2:15pm
...I have been thinking about it and came to the conclusion that my DNG's don't have any embedded jpg as I am shooting raw only. libraw tries to extract the jpg and exiftool generates thumbnail out of the DNG I guess...
When you shoot RAW only on a camera, it should produce a RAW file with a jpeg copy built into the file. One reason for this is that your camera cannot display the RAW file, so needs a simple jpeg copy to show on your camera's screen.

As far as I know, exiftool cannot convert RAWs into jpeg copies.

I would be interested in a copy of your DNG file. Can you send via Firefox Send?

User avatar
stevedee
Posts: 455
Joined: Monday 20th March 2017 6:06pm

Re: Component to preview files in a directory

Post by stevedee » Monday 29th March 2021 5:08pm

OK, sorry!

Forget Firefox Send, it looks like the service was disabled last September ...well nobody told me!

User avatar
stevedee
Posts: 455
Joined: Monday 20th March 2017 6:06pm

Re: Component to preview files in a directory

Post by stevedee » Wednesday 31st March 2021 2:59pm

Thanks for sending me the image Detlef.

I can extract the jpeg from within the RAW file;
01McAc_jpgInRaw.png
01McAc_jpgInRaw.png (281.29 KiB) Viewed 1494 times
...and the jpeg image file details (which is a 2.3MB file) look like this;
01McAc_jpeg.png
01McAc_jpeg.png (51.6 KiB) Viewed 1494 times

01McAc
Posts: 67
Joined: Sunday 24th January 2021 8:25pm

Re: Component to preview files in a directory

Post by 01McAc » Wednesday 31st March 2021 5:54pm

hmm, there must be something wrong in my code. The problem sits mostly in front of the monitor :shock:
Did you extract the thumbnail with libraw and in the app you provided before for download?

User avatar
stevedee
Posts: 455
Joined: Monday 20th March 2017 6:06pm

Re: Component to preview files in a directory

Post by stevedee » Wednesday 31st March 2021 6:10pm

01McAc wrote:
Wednesday 31st March 2021 5:54pm
hmm, there must be something wrong in my code...
I suggest you paste the libraw section of your code.

01McAc
Posts: 67
Joined: Sunday 24th January 2021 8:25pm

Re: Component to preview files in a directory

Post by 01McAc » Friday 02nd April 2021 11:09am

stevedee wrote:
Wednesday 31st March 2021 6:10pm
I suggest you paste the libraw section of your code.
There must be some magic in the code. I double checked my code, made no changes et voilá: it works. Great stuff. Thank you.
The only remaining question is still the non-preview of the DNG in the FileView component. Dolphin and Nautilus (see attachment) both are able to show a tiny preview of DNG files. Dolphin is a QT based program and I presume Gambas uses the same components of QT.
Screenshot_20210402_130237.jpg
Screenshot_20210402_130237.jpg (33.01 KiB) Viewed 1460 times

User avatar
BruceSteers
Posts: 652
Joined: Thursday 23rd July 2020 5:20pm

Re: Component to preview files in a directory

Post by BruceSteers » Friday 02nd April 2021 11:22am

01McAc wrote:
Friday 02nd April 2021 11:09am
stevedee wrote:
Wednesday 31st March 2021 6:10pm
I suggest you paste the libraw section of your code.
There must be some magic in the code. I double checked my code, made no changes et voilá: it works. Great stuff. Thank you.
The only remaining question is still the non-preview of the DNG in the FileView component. Dolphin and Nautilus (see attachment) both are able to show a tiny preview of DNG files. Dolphin is a QT based program and I presume Gambas uses the same components of QT.
Screenshot_20210402_130237.jpg
It's got nothing to do with QT
Nautilus/Dolphin are doing the work not QT

It's funny how you seem to think,, Nautilus does it and it uses qt so gambas should too as it uses qt.
After it has been explained :lol:
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
stevedee
Posts: 455
Joined: Monday 20th March 2017 6:06pm

Re: Component to preview files in a directory

Post by stevedee » Friday 02nd April 2021 2:35pm

01McAc wrote:
Friday 02nd April 2021 11:09am

There must be some magic in the code. I double checked my code, made no changes et voilá: it works. Great stuff. Thank you.
You are very welcome!
... Dolphin and Nautilus ... both are able to show a tiny preview of DNG files...
I'm 95% sure that gnome-raw-thumbnailer is installed on your system, and that file managers such as Nautilus use this to extract jpegs from some RAW files (I think you may have to alter settings or do something to get it to work with other types of RAW files such as {say} .CR2).

The file manager "Nemo" on my light-weight Peppermint system did not display RAW thumbnails until a few minutes ago, when I installed gnome-raw-thumbnailer, and now it does.

So what we need now is for some cleaver guy to modify the FileView class to get it to work with gnome-raw-thumbnailer

User avatar
stevedee
Posts: 455
Joined: Monday 20th March 2017 6:06pm

Re: Component to preview files in a directory

Post by stevedee » Friday 02nd April 2021 2:54pm

Let me retract the bit about .CR2 files.

gnome-raw-thumbnailer uses /usr/share/thumbnailers/gnome-raw.thumbnailer which contains this:-

Code: Select all

[Thumbnailer Entry]
TryExec=gnome-raw-thumbnailer
Exec=gnome-raw-thumbnailer -s %s %u %o
MimeType=image/x-adobe-dng;image/x-canon-cr2;image/x-canon-crw;image/x-dcraw;image/x-fuji-raf;image/x-kodak-dcr;image/x-kodak-k25;image/x-kodak-kdc;image/x-minolta-mrw;image/x-nikon-nef;image/x-olympus-orf;image/x-panasonic-raw;image/x-pentax-pef;image/x-sigma-x3f;image/x-sony-arw;image/x-sony-sr2;image/x-sony-srf;
...which does include support for .CR2 and many more.

Post Reply