Advertisement
theroot

g13lcd.sh

Feb 8th, 2013
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.92 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # a simple image file builder to display on the g13 lcd screen. requires netpbm, imagemagik, ecraven's g13
  4.  
  5. tmpfile=/tmp/g13lcd.tmp
  6.  
  7. rm -rf ${tmpfile}.*
  8.  
  9. function textToLCD {
  10.  
  11.         pbmtext ${mytext} >${tmpfile}.pbm
  12.         convert ${tmpfile}.pbm -resize 160x43! ${tmpfile}.resized.pbm
  13.         cat ${tmpfile}.resized.pbm | pbm2lpbm > ${tmpfile}.lpbm
  14.         cat ${tmpfile}.lpbm >/tmp/g13-0
  15.  
  16. }
  17.  
  18. function imageToLCD {
  19.  
  20.         convert ${myimage} -resize 160x43! ${tmpfile}.resized.pbm 2>&1 |tee >/dev/null
  21.         cat ${tmpfile}.resized.pbm | pbm2lpbm > ${tmpfile}.lpbm
  22.         cat ${tmpfile}.lpbm >/tmp/g13-0
  23.  
  24. }
  25.  
  26. case "$1" in
  27.                 --text2lcd)
  28.                         mytext=`echo "$*" |sed "s/--text2lcd //"`
  29.                         textToLCD
  30.                 ;;
  31.                 --image2lcd)
  32.                         myimage=$2
  33.                         imageToLCD
  34.                 ;;
  35. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement