Programming and Scripting :: Fast icon converter (to xpm).



#!/bin/bash
     
  # requires imagemagick.uci
     
  #makes sure imagemagick is loaded; if not, loads it:
     
  #***  EDIT  path to imagemagick.uci ******
  [ -d /opt/imagemagick ] || mydsl-load /mnt/hda3/imagemagick.uci
     
     
  echo -n 'icon to convert? '
  read ICON
     
  #converts to .xpm file and places in dfm icon folder:
 
     
   #***  EDIT  path to $ICON ****
  IPATH='/mnt/hda3/Downloads'
     
     [ -f /$IPATH/$ICON ] && sudo /opt/imagemagick/bin/convert $IPATH/$ICON /usr/share/dfm/icons/${ICON%.*}.xpm

Edited the script so that it replaces the former icon name with .xpm vs just adding it on.
Edit:  Put in IPATH var to simplify path edit.
Added drop & drag  from any icon; converts to .xpm and sends to dfm icon directory.  

- - - - - - - - - - - - - - - - - - - - -
#!/bin/bash

# Works with drag & drop, argument <path/icon>, or double clicking.
# For double clicking, edit icon path in script.  
# Requires imagemagick.uci

#make sure imagemagick is loaded; if not, load

#***  EDIT  mydsl-load path ******
[ -d /opt/imagemagick ] || mydsl-load /mnt/hda3/imagemagick.uci

#***  EDIT  path to $ICON (for double clicking)
IPATH='/mnt/hda3/Downloads'

if [ "$1" = "" ]; then
echo -n 'icon to convert? '
read ICON
fi

if [ "$1" != "" ]; then
ICAN="$1"
ICON=${ICAN##*/}
IPATH=$(dirname $1)
fi

#convert to .xpm file and place in dfm icon folder



[ -f $IPATH/$ICON ] && sudo /opt/imagemagick/bin/convert $IPATH/$ICON \
/usr/share/dfm/icons/${ICON%.*}.xpm

Thanks J,

I just used this with drag and drop and it was very helpful.

Next Page...
original here.