This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Thumbnailer for KDE5

Tags: thumbnail, thumbnailer thumbnail, thumbnailer thumbnail, thumbnailer
(comma "," separated)
piet85
Registered Member
Posts
15
Karma
0
OS

Thumbnailer for KDE5

Mon Apr 18, 2016 10:47 am
Hello, I'm looking for Dolphin KDE5 thumbnailers for Fedora for the following filetypes: PDF, Open Document files, MS Office files, and raw photos (NEF).
Is there a way to get thumbnails for these files in KDE5?
I already found a solution to get KDE Image Menu working in KDE5, which I achieved by linking the old KDE4 .desktop files to the KDE5 folder:
Code: Select all
ln -s /usr/share/kde4/services/ServiceMenus/kim_compressandresize.desktop /usr/share/kde4/services/ServiceMenus/kim_convertandrotate.desktop /usr/share/kde4/services/ServiceMenus/kim_publication.desktop ~/.local/share/kservices5/ServiceMenus/

I tried to modify the thumbnailers in the same way. At least the entry in Dolphin appears, but no thumbnails are created. No wonder cause the .desktop file just defines for which files the thumbs will be created and so on. To each of these .desktop files there's an .so file, when I'm right, this is the one that does the thumbnail creation? Will it work when I copy/link these to the right place and where is the right place? Do I need to modify more files? Or is it not that simple and the whole program has to be rewritten? Is there any other easy way to port the old thumbnailers to KDE5?
User avatar
Rog131
Registered Member
Posts
828
Karma
10

Re: Thumbnailer for KDE5

Mon Apr 18, 2016 1:29 pm
Service Menus

The KDE4 is looking services from:
Code: Select all
kde4-config --path services


The KF5 is looking services from:
Code: Select all
kf5-config --path services


The ServiceMenus directories are subdirectories of those.

Image


Thumbnailers

Earlier: viewtopic.php?f=223&t=129633#p346716

The KDE applications can show a thumbnail for a file if there is a thumb creator plugin installed for the file type.

The KDE is using freedesktop specifications: http://freedesktop.org/wiki/Specifications/ and there the specification for storing file thumbnails: http://specifications.freedesktop.org/t ... atest.html.

KDE api for the thumbnailers:

KDE4: http://api.kde.org/4.x-api/kdelibs-apid ... eator.html
KF5: http://api.kde.org/frameworks-api/frame ... eator.html

After the installation of the thumbnailer it need to be enabled from the application (Dolphin, Folder View, etc.)
Image


thumbnailers for the following filetypes: PDF, Open Document files, MS Office files, and raw photos (NEF).


KDE (KF5) has a thumbnailer for the PDF - ( https://projects.kde.org/projects/kde/k ... umbnailers ) - Arch package name is kdegraphics-thumbnailers. Maybe it is same for the Fedora ?

Open Document files should have the thumbnail included: https://en.wikipedia.org/wiki/OpenDocument > https://en.wikipedia.org/wiki/OpenDocum ... rectory.29
Thumbnails (directory)

Thumbnails is a separate folder for a document thumbnail. The thumbnail must be saved as “thumbnail.png”. A thumbnail representation of a document should be generated by default when the file is saved. It should be a representation of the first page, first sheet, etc. of the document. The required size for the thumbnails is 128x128 pixel. In order to conform to the Thumbnail Managing Standard (TMS) at http://www.freedesktop.org, thumbnails must be saved as 8bit, non-interlaced PNG image with full alpha transparency.


This is easy to use/show with the Keneric KDE (KF5) thumbnailer: http://kde-apps.org/content/show.php/Keneric+KDE+(KF5)+thumbnailer?content=174485
Image

I'm not sure if there is KF5 thumbnailer for the MS Office files, and raw photos (NEF). But there is rawthumbnailer (RAW Photo Camera Files). It is part of the kdegraphics-thumbnailers.

A page for the Nautilus tells: http://bernaerts.dyndns.org/linux/76-gn ... l-nautilus
With the help of LibreOffice unoconv conversion tool, it is possible to use the first page of a document as a Nautilus thumbnail.

Maybe same will work with the Keneric ?.
piet85
Registered Member
Posts
15
Karma
0
OS

Re: Thumbnailer for KDE5

Wed Apr 20, 2016 8:29 am
First of all thank you for your detailed answer! The path for the service menus is correct,
Code: Select all
kf5-config --path services
shows me the same path where the ServiceMenus folder is located to which I tried to link the old thumbnailers. They also appear in Dolphins previews menu and they are enabled. So that shouldn’t be the problem. But the API confirms, what I suggested: The .desktop file is just a description of the thumbnailer, the real work is done somewhere else. So if I understand aright, what’s written in the API, just moving some files around doesn’t get me any further, does it?
But maybe trying to port old KDE4 thumnailers generally is a waste of time when there are KDE5 solutions for every filetype:
Open Document: I think this could be easily done with Keneric, by extracting the embedded thumbnail from the Open Document file.
PDF and raw photo: For those files there are thumbnailers for KDE5 that should work. This needs some further research, why they doesn’t work on my system. The following packages are installed: kdegraphics, kdegraphics –thumbnailers, dcraw. Although those packages are installed there is no entry showing up in Dolphin’s previews menu. So do you have any idea why they don’t work or where I can start to look for errors?
MS Office files: It would have been good to have, but at least I have just a few MS Office files, so it’s not worth the effort. When I'm right Koffice contained thumbnailers for MS documents and that's the way I've done this in KDE 4.
User avatar
Rog131
Registered Member
Posts
828
Karma
10

Re: Thumbnailer for KDE5  Topic is solved

Wed Apr 20, 2016 3:53 pm
piet85 wrote:...
But the API confirms, what I suggested: The .desktop file is just a description of the thumbnailer, the real work is done somewhere else. So if I understand aright, what’s written in the API, just moving some files around doesn’t get me any further, does it?
...
PDF and raw photo: For those files there are thumbnailers for KDE5 that should work. This needs some further research, why they doesn’t work on my system.
...
The following packages are installed: kdegraphics, kdegraphics –thumbnailers, dcraw. Although those packages are installed there is no entry showing up in Dolphin’s previews menu. So do you have any idea why they don’t work or where I can start to look for errors?
....
MS Office files: It would have been good to have, but at least I have just a few MS Office files, so it’s not worth the effort. When I'm right Koffice contained thumbnailers for MS documents and that's the way I've done this in KDE 4.


The thumbnailer binary has two part:
- desktop file: the desktop file has the information to be shown.
- shared library file (.so). This part is the compiled plugin.

You could add/link the old KDE4 desktop file to the KDE Frameworks 5 directory. This will add the preview option to the Dolphin etc. But it won't add the working code.

The KDE4 is using Qt4 and KDE4 libraries. Also the thumbnails are saved/read from the $HOME/.thumbnails/. And the thumbnail names are different...

The KF5 is using Qt5 and KDE frameworks 5. The thumbnails are saved to the $HOME/.cache/.thumbnails/. XDG Base Directory Specification:
$XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.


You could list installed (KF5) thumbnailers:
Code: Select all
ls /usr/share/kservices5/ | grep thumb


gsthumbnail.desktop is
Code: Select all
[Desktop Entry]
Type=Service
Name=PostScript, PDF and DVI Files
...
X-KDE-ServiceTypes=ThumbCreator
MimeType=application/x-dvi;application/postscript;application/pdf;image/x-eps;
X-KDE-Library=gsthumbnail
CacheThumbnail=true


It is looking (X-KDE-Library):
Code: Select all
locate $ locate gsthumbnail.so
/usr/lib/qt/plugins/gsthumbnail.so

Note! this path is with the Arch Linux.

Making a search with: 'fedora kdegraphics-thumbnailers 15.12.3' -> https://rpmfind.net/linux/rpm2html/search.php?query=kdegraphics-thumbnailers(x86-64)

Available:
kdegraphics-thumbnailers-16.04.0-1.fc24 RPM for x86_64
Files

/usr/lib64/qt5/plugins/gsthumbnail.so
/usr/lib64/qt5/plugins/rawthumbnail.so
/usr/share/kservices5/gsthumbnail.desktop
/usr/share/kservices5/rawthumbnail.desktop
/usr/share/licenses/kdegraphics-thumbnailers
/usr/share/licenses/kdegraphics-thumbnailers/COPYING
/usr/share/licenses/kdegraphics-thumbnailers/COPYING.LIB


...
kdegraphics-thumbnailers-15.04.2-2.fc23 RPM for x86_64

Note !! This is for the KDE4 as shown by the file list:

Files

/usr/lib64/kde4/gsthumbnail.so
/usr/lib64/kde4/rawthumbnail.so
/usr/share/doc/kdegraphics-thumbnailers
/usr/share/doc/kdegraphics-thumbnailers/COPYING
/usr/share/doc/kdegraphics-thumbnailers/COPYING.LIB
/usr/share/kde4/services/gsthumbnail.desktop
/usr/share/kde4/services/rawthumbnail.desktop
piet85
Registered Member
Posts
15
Karma
0
OS

Re: Thumbnailer for KDE5

Tue May 03, 2016 4:34 pm
Sorry I didn't answer some time, but I had no time to deal with this problem within the last days.
Meanwhile I solved the problem with your help:
For Opendocument I solved it with Keneric:
Code: Select all
application/vnd.oasis.opendocument.text)
      unzip -p "$fullname" Thumbnails/thumbnail.png > "$exportPicture"
      exit
      ;;

This works pretty well, the original thumbnailer looked a bit better, cause there was a watermark of the mimetype symbol on the thumbnail, but that's not essential. The same also works with spreadsheet files when substituting opendocument.text with opendocument.spreadsheet. It should work for other opendocument files too, but I only need those two.
For PDF and RAW files I solved it by just installing the F24 RPM file from rpmfind. Not a clean solution to install packages destined for another releaseversion, but it has no F24 dependencies at all, just depends on two F23 packages, so it should be ok this time.
Thank you a lot for your help!


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], rockscient, Yahoo [Bot]