extra options on right click
Spyros Tsiolis
stsiol at yahoo.co.uk
Sun Jan 31 17:14:07 UTC 2016
--------------------------------------------
On Sun, 31/1/16, Ralf Mardorf <silver.bullet at zoho.com> wrote:
Subject: Re: extra options on right click
To: ubuntu-users at lists.ubuntu.com
Date: Sunday, 31 January, 2016, 14:25
Hi,
as Johnny already pointed out use imagemagick.
Install
http://packages.ubuntu.com/precise/imagemagick
, by running
sudo
apt-get update && sudo apt-get install
imagemagick
With an editor write and save
this as file /usr/local/bin/convert2icon:
#!/bin/dash
exec convert "$1" -resize 48x48
"$1"$(printf "%.8b" $(mcookie)).png
Feel free to use replace
"48x48" by another value [1].
Then run:
sudo chmod a+x /usr/local/bin/convert2icon
For the file manager SpaceFM you could include
it as tool, like this
Tools > right click > New > Command
Type: Command
Name: convert to icon
Key
: Ctrl+2
Icon: edit-cut
[x] Command Line
convert2icon %f
After
selecting a picture and pushing the shortcut Ctrl+2 it will
be
resized, without changing the aspect
ratio [1] and then it will be saved
as PNG,
even if the original is a JPG.
To make it available by right
click menu for SpaceFM add it like this:
Right click on a JPG file > Open >
Choose... >
Command:
/usr/local/bin/convert2icon
Do the same for PNG. Once it was chosen,
it's provided by the list of
applications of the right click menu.
Use the Ubuntu help pages how
to do something similar for other
file
managers.
From command line the syntax
is:
convert2icon
/path/file_name
For
example:
$ ls -Ggh
Desktop/
total 184K
-rw-r--r-- 1 180K Jan 31 12:57 example pic with
spaces in file name.jpg
$
convert2icon Desktop/example\ pic\ with\ spaces\ in\ file\
name.jpg
$ ls -Ggh
Desktop/
total 196K
-rw-r--r-- 1 180K Jan 31 12:57 example pic with
spaces in file name.jpg
-rw-r--r-- 1 9.6K
Jan 31 13:00 example pic with spaces in file
name.jpg1c63ee23.png
Regards,
Ralf
[1]
http://www.howtogeek.com/109369/how-to-quickly-resize-convert-modify-images-from-the-linux-terminal/
----------------------------------------------------------------------------------------------------------
Ralph / John,
Thank you very much for your help.
I do remember stumbling upon such a solution some time ago.
I never bothered to go down that path though. Didn't need it at the time.
Ralph thank you so much for your detailed guide. Will try it.
I also did some digging and found that "nautilus-image-manipulator"
and "nautilus-iamge-converter" also do the trick.
I tried it on a VM with 64-bit Ubuntu 14.04 and it doesn't work.
Tried it on my trusty ubuntu 32-bit 12.04 server and it worked.
I will try it tomorrow on-site on the thin-client and see if it works.
Thank you all again for your time,
regards,
spyros
More information about the ubuntu-users
mailing list