Initial revision
This commit is contained in:
commit
365fe3e5b6
350 changed files with 43559 additions and 0 deletions
77
src/tuxpaint-import.sh
Executable file
77
src/tuxpaint-import.sh
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
#!/bin/sh
|
||||
|
||||
# tuxpaint-import
|
||||
|
||||
# "Tux Paint Import"
|
||||
# Import an arbitrary GIF, JPEG or PNG into Tux Paint
|
||||
|
||||
# by Bill Kendrick
|
||||
# bill@newbreedsoftware.com
|
||||
# http://www.newbreedsoftware.com/tuxpaint/
|
||||
|
||||
# September 21, 2002 - January 16, 2003
|
||||
|
||||
|
||||
TMPDIR=/tmp
|
||||
SAVEDIR=$HOME/.tuxpaint/saved
|
||||
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
# No arguments provided (sorry, you can't pipe into this script's stdin!)
|
||||
echo "Usage: tuxpaint-import filename(s)"
|
||||
echo " tuxpaint-import --help"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $1 == "--help" ]]; then
|
||||
# --help, show usage:
|
||||
echo
|
||||
echo "tuxpaint-import"
|
||||
echo
|
||||
echo "Imports an arbitrary image (GIF, JPEG, PNG, etc. format)"
|
||||
echo "into Tux Paint (see: tuxpaint(1)) so that it appears in the"
|
||||
echo "'Open' dialog."
|
||||
echo
|
||||
echo "Usage: tuxpaint-import filename(s)"
|
||||
echo " tuxpaint-import --help"
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Make sure savedir exists!
|
||||
if [ ! -d $SAVEDIR ]; then
|
||||
echo "Creating $SAVEDIR"
|
||||
mkdir -p $SAVEDIR
|
||||
fi
|
||||
|
||||
|
||||
# For each picture list...
|
||||
for i in $*
|
||||
do
|
||||
if [ -e $i ]; then
|
||||
# Determine a filename for it:
|
||||
NEWFILENAME=`date "+%Y%m%d%H%M%S"`
|
||||
echo "$i -> $SAVEDIR/$NEWFILENAME.png"
|
||||
|
||||
# Convert and scale down, save as a temp file:
|
||||
anytopnm $i | pnmscale -xysize 448 376 > $TMPDIR/$NEWFILENAME.ppm
|
||||
|
||||
# Place inside the correctly-sized canvas:
|
||||
# FIXME: Center, instead of placing at upper right
|
||||
ppmmake "#FFFFFF" 448 376 \
|
||||
| pnmpaste -replace $TMPDIR/$NEWFILENAME.ppm 0 0 \
|
||||
| pnmtopng > $SAVEDIR/$NEWFILENAME.png
|
||||
|
||||
# Remove temp file:
|
||||
rm $TMPDIR/$NEWFILENAME.ppm
|
||||
|
||||
# Create thumbnail for 'Open' dialog:
|
||||
pngtopnm $SAVEDIR/$NEWFILENAME.png | pnmscale -xysize 92 56 \
|
||||
| pnmtopng > $SAVEDIR/$NEWFILENAME-t.png
|
||||
|
||||
else
|
||||
# File wasn't there!
|
||||
echo "$i - File not found"
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue