Dolphin service menu for resizing images

“ReImage” is popular, but isn’t working in Plasma 6.0.
Anyone know of an image resize service menu or such for Dolphin, available for Plasma 6.0?

Have you tried moving the .desktop files to the correct location for Plasma 6 ?

 sudo mv /usr/share/kservices5/ServiceMenus/reimage* /usr/share/kio/servicemenus/
2 Likes

Thanks for the help.
The deb install failes, and the install.sh from the tar seems to default to installing files in my home directory (bin, and a shared directory), and spits out a few warnings including a “command not found”. So, there is no ```
/usr/share/kservices5/ServiceMenus/reimage*

I tried plasma 6 but couldn’t get over 50% of my existing plasma 5 service menus’ to work, no matter where I put them. Anyway, you could try to make a simple servicemenu which uses the convert command from imagemagick package. Otherwise, use gwenview. There are other tools of course, but since you want a servicemenu, one with a couple of convert submenus for given sizes could do the trick.

OK, so you did a clean install. Yup - it will likely fail - it calls kf5-config which I’m guessing won’t be there.

and the install.sh from the tar seems to default to installing files in my home directory

As it is designed to, but will fail for the above reasons.

Chuck the .desktop files into the ~/.local/share/kio/servicemenus directory

Chuck reimage-kdialog into ~/.local/bin

make sure ~/.local/bin is in your $PATH

Consider running kbuildsycoca6

Consider installing dependencies

Consider removing the .local/share/kservices5/ServiceMenus directory

For a simple resizing servicemenu using convert you could put the commands straight in the desktop file. But if you want a better option which would create a resized file in the same directory you could make it call for a script.
For example, a script that resizes the image by 50% would look like:

#!/bin/bash

_file="${1}"
_directory=$(dirname "$_file")
_filename=$(basename "$_file")
convert "${_file}" -resize 50% "${_directory}/50%_${_filename}"

The desktop file ( servicemenu) would then look something like:

[Desktop Entry]
ServiceTypes=KonqPopupMenu/Plugin,image/*
Type=Service
Actions=50%;
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=image/*
X-KDE-Submenu=Images

[Desktop Action 50%]
Name=Resize 50%
Icon=document-edit
Exec=bash ~/Scripts/50%.sh %f

You’d just need a couple of script for certain sizes ( in % or px) and add the submenus ( the execs pointed to the scripts) to the servicemenu.

2 Likes

Thank you, this worked great!

Tracyanne made a python based servicemenu once. But it’s qt5.
https://discuss.kde.org/t/resizing-photos-using-dolphin-service-menu-options/2292

I eventually rewrote it using QML and Python. It’s QML 5, but converting QML 6 should be trivial.

I should have done this before, but I will create a GitHub project for it.

If they don’t also ban this account, I’ll post a link.

Ah, cool. I’m sure some folks will like it.

This worked for me!
Thank you very much!

The GitHub repository is public at

it’s still QML 2.15 (QT5.15) and PyQt5. But take a look, and let me know what you think.

This is the code I’m currently running in my Dolphin Service Menu

When I get some time, and a Plasma 6 desktop to test it on, I’ll probably make the changes… or anyone else is welcome to convert it to plasma6.

Hmm…can’t get it to work. It shows up alright, but no window popup. Must be missing something.

Sorry haven’t updated the Readme file yet.

if you are testing in the CLI

use either

python3 -m <python filename without the extension> <full path to an image file>

or

./<python filename.py> <full path to an image>

the .desktop files need to go in the servicemenu folder for Dolphin, under ~/.local and the exe path in the file should point to where you've stored the app.

I’ll be on the road for about the next 5 or 6 hours, I’ll check back when I get to my destination.

Moving the desktop files from share/kservices5/ServiceMenus to share/kio/servicemenus is on thing that’s needed for old menus, but there’s more.

See Creating Dolphin Service Menus | Developer for up-to-date information on how to create a service menu

Myeah…I’m getting the error

Traceback (most recent call last):
File “”, line 189, in _run_module_as_main
File “”, line 112, in _get_module_details
File “/home/john/.local/share/kservices5/Feral-Image-Conversion-main/QMLResize/resize/resize.py”, line 27, in
from PyQt5.QtQml import QQmlApplicationEngine
ModuleNotFoundError: No module named ‘PyQt5.QtQml’

Yeah, for some, but this isn’t a particularly clever menu - for the item in question the only minor points are that menus are sorted alphabetically, so _SEPARATOR_s are moot (unless there is some trick to specify the order of Actions), and the rogue agif Action

Probably no PyQT5.

Clearly I have to get a Plasma 6 desktop up and running, so I can test it. I’m on Manjaro KDE StaPlasma 6 yesterday) or set up a Kde Neon install, on a VM.

I had to create yet another account, because for some ridiculous reason new users are allowed only 3 posts per subject.

So if I don’t get banned for pointing out that stupid idea, I’ll get back to you.

The requirements are all there. Besides, I’m fine with reimage ( although I actually prefer KIM) and I’m far from switching to plasma 6. Gonna avoid it as long as possible.

There is a “trick” to get the menu items more or less where you want them. You need to give the actions ridiculous but semi-alphabetic names or give them numbers. Just the action names, not the name.

1 Like