Jpg2xpm.sh
Aus VDR Wiki
(Unterschied zwischen Versionen)
(→jpg2xpm.sh) |
K |
||
Zeile 1: | Zeile 1: | ||
==jpg2xpm.sh== | ==jpg2xpm.sh== | ||
+ | {{Box Datei | $PATH/jpg2xpm.sh | | ||
<pre> | <pre> | ||
#!/bin/sh | #!/bin/sh | ||
# | # | ||
− | # | + | # jpg2xpm.sh |
# | # | ||
# Source: http://www.vdrportal.de/board/thread.php?threadid=14385 | # Source: http://www.vdrportal.de/board/thread.php?threadid=14385 | ||
Zeile 33: | Zeile 34: | ||
| dialog --gauge " " 7 60 | | dialog --gauge " " 7 60 | ||
</pre> | </pre> | ||
+ | }} | ||
==jpg2logo.scm== | ==jpg2logo.scm== | ||
+ | {{Box Datei | $HOME/jpg2logo.scm | | ||
<pre> | <pre> | ||
(define (script_fu_tovdr width height depth infile outfile) | (define (script_fu_tovdr width height depth infile outfile) | ||
Zeile 57: | Zeile 60: | ||
SF-FILENAME "Outfile" "/tmp/outfile.xpm") | SF-FILENAME "Outfile" "/tmp/outfile.xpm") | ||
</pre> | </pre> | ||
+ | }} | ||
[[Kategorie:Scripts]] | [[Kategorie:Scripts]] |
Version vom 20. Juli 2005, 14:35 Uhr
jpg2xpm.sh
#!/bin/sh # # jpg2xpm.sh # # Source: http://www.vdrportal.de/board/thread.php?threadid=14385 # # copy the 'jpg2logo.scm' to $HOME/.gimp-<VERSION>/scripts # CONFIG START LOGO_WIDTH=64 LOGO_HEIGHT=48 LOGO_DEPTH=16 LOGO_DIR=/tmp/logos # CONFIG END mkdir -p $LOGO_DIR LOGOS=`find $LOGO_DIR -maxdepth 1 -name "*.jpg"` COUNT=`echo "$LOGOS" | wc -l | tr -d ' '` for INPUT in $LOGOS ; do i=$[i+1] OUTPUT=`echo $INPUT | sed 's/^\(.*\)\(\.[^.]*\)$/\1/'` OUTPUT="$OUTPUT.xpm" echo -e "XXX\n$(($i*100/$COUNT))\n $i/$COUNT ${INPUT#./*}\nXXX" if [ ! -e "${OUTPUT#./*}" ] ; then BATCHCMD="gimp -i -d -b '(script_fu_tovdr $LOGO_WIDTH $LOGO_HEIGHT $LOGO_DEPTH \"$INPUT\" \"$OUTPUT\")' '(gimp-quit 0)'" eval "$BATCHCMD" fi done \ | dialog --gauge " " 7 60
jpg2logo.scm
(define (script_fu_tovdr width height depth infile outfile) (let* ((img (car (file-jpeg-load 1 infile infile))) (drawable (car (gimp-image-active-drawable img)))) (gimp-image-scale img width height) (gimp-convert-indexed img 2 0 depth 0 0 "") (file-xpm-save 1 img drawable outfile outfile 255))) (script-fu-register "script_fu_tovdr" _"<Toolbox>/Xtns/Script-Fu/Utils/TOVDR" "TOVDR" "niklot" "niklot" "2003-03-25" "" SF-VALUE "Width" "64" SF-VALUE "Height" "48" SF-VALUE "Depth" "16" SF-FILENAME "Infile" "/tmp/infile.jpg" SF-FILENAME "Outfile" "/tmp/outfile.xpm")