Fast icon converter (to xpm).


Forum: Programming and Scripting
Topic: Fast icon converter (to xpm).
started by: jpeters

Posted by jpeters on Nov. 14 2007,08:27
#!/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

Posted by jpeters on Nov. 15 2007,15:37
Edited the script so that it replaces the former icon name with .xpm vs just adding it on.
Posted by jpeters on Nov. 17 2007,19:11
Edit:  Put in IPATH var to simplify path edit.
Posted by jpeters on Dec. 03 2007,20:59
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

Posted by john.martzouco on Dec. 30 2007,21:44
Thanks J,

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

Posted by jpeters on Dec. 30 2007,21:58
Quote (john.martzouco @ Dec. 30 2007,16:44)
Thanks J,

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

Your welcome. John.  I just noticed that I had the ''EDIT ICON" path listed twice (now deleted).
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.