scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

puffy.sh (853B)


      1 #!/bin/sh
      2 
      3 # wireframe puffy generator
      4 # img from: http://www.openbsd.org/images/tshirt-23.gif
      5 # needs: imagemagick
      6 
      7 SRC=tshirt-23.gif
      8 DST=puffy.png
      9 
     10 COLOR=00ffff # tron like
     11 COLOR=00ff00 # true green
     12 GEOM=646x710 # with openbsd text
     13 GEOM=646x610 # without the text
     14 
     15 # prepare colors
     16 GRAY=3f3f3f # this is the bg val after grayscale
     17 COLORNEG=$(perl -e "printf \"%x\n\", 0xffffff - 0x$COLOR")
     18 
     19 # prepare masks
     20 convert -size $GEOM xc:#$GRAY gray.png
     21 convert -size $GEOM xc:#$COLORNEG colorneg.png
     22 
     23 # grayscale it
     24 convert $SRC -colorspace gray -crop "$GEOM+1+1" puffy_gray.png
     25 # apply gray mask until black background
     26 composite puffy_gray.png gray.png -compose Minus puffy_black.png
     27 # apply color mask to get foreground
     28 composite puffy_black.png colorneg.png -compose Minus $DST
     29 
     30 # remove temp files
     31 rm gray.png colorneg.png puffy_gray.png puffy_black.png