Nautilus plugins (Public Domain) for working with icons to enhance illustrations


Quite a lot of the documentation that I write for work involves using icons as part of the images that I create. It is quite a pain having to open an icon in an application just to resize it, change its colour or make it transparent. I always say, if you have to do something more than three times, script it. So I wrote a few Nautilus scripts for working with icons.

Nautilus scripts are little programs that add new options to the contextual menu of Nautilus file manager. This menu is displayed when you right click on a file or folder name in the file manager. The scripts are written inBash, so they should work on any Ubuntu distribution that uses Nautilus file manager. Of course, you can write your own scripts in whatever you like,Bash, PHP, Ruby, etc. I just use Bash.

Here is what the scripts do:

  • change icon colours
  • trim excess transparent or white space around an icon
  • resize an icon
  • make PNG icons transparent
  • clean up all the files that various manipulations produce

I consider these scripts to be dedicated to the Public Domain, so they have neither license, responsibilities nor expectations.  If you would like to send improvements, by all means do so, I would like that, but you don’t have to do so.

To use these scripts, download them, then copy them into the nautilus scripts directory:

~/.local/share/nautilus/scripts

and unzip them.

They should harmless, but there are no checks built in at all.  In particular, I would not use the cleanup script except on folders where only icons are kept! Here is what one of the scripts looks like.

#!/bin/bash
# Made by Derek Keats Converts black icon to white using inversion, or inverts any other colour
# This script is dedicated to the Public Domain. You may
# do what you wish with it.
IFS=$'\t\n'
cd $NAUTILUS_SCRIPT_CURRENT_URI
for line in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
filename=$(basename "$line")
extension="${filename##*.}"
filepart="${filename%.*}"
outfile="$filepart""_inverted.""$extension"
convert $filename -negate $outfile
done

Here are some commands to grab stuff from the command line.

wget http://blog.dkeats.com/wp-content/uploads/2017/02/Icon-manipulation.zip
mv Icon-manipulation.zip ~/.local/share/nautilus/scripts/
cd ~/.local/share/nautilus/scripts/
unzip Icon-manipulation.zip

That’s it, if you right click on one or more icons in a folder, you should be able to execute these scripts from the Scripts popup menu. If you don’t see the commands, you will have to go into each directory and mark the files executable. You can do this using Nautilus file manager, or from the command by

cd directory
chmod +x *

Download and install manually

Use the link below to grab the scripts:
Icon manipulation scripts

Comments

comments