extra options on right click

Ralf Mardorf silver.bullet at zoho.com
Sun Jan 31 12:25:02 UTC 2016


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/
  





More information about the ubuntu-users mailing list