LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] shell scripts and graphics...

[ILUG] shell scripts and graphics...

kevin lyda kevin at suberic.net
Wed Nov 24 14:08:10 GMT 1999


my reviews were made much simpler (and smaller) by cropping the vmware
borders.  however i didn't do them by hand.  one of the great things
about unix is shell scripting and how small menial tasks can be
automated.  redhat comes with what used to be in a tarball called netppm
orsomething - i guess it's now in the libgr project and is in the
libgr-progs rpm.  very useful.

anyway, on the script side, the down side is scripts can get downright
ugly.

on that note, here's the script i used in case it might be of use to
anyone.  it's smaller then an an snipped cookbook spam, so i suppose
it's ok to include!

kevin

----blurb----
run this as script.sh foo.jpeg

it must be run *IN THE DIR* where the script is.  it will copy the
original file into a directory called old in that directory.

this is quick and dirty.  it did a single task for me very quickly (vs.
the two hours or so i'd probably need to spend on it.).  maybe it can
help you, but read it first!
----snip here----
#!/bin/sh
jpeg=$1
old=old/$jpeg
base=`basename $jpeg .jpeg`
ppm=${base}.ppm
x=9
y=34

if [ ! -d old ]; then
	mkdir old || exit 2
fi
#	echo $jpeg $old $base $ppm
djpeg $jpeg > $ppm
width=`head -2 $ppm | tail -1 | cut '-d ' -f1`
height=`head -2 $ppm | tail -1 | cut '-d ' -f2`
#	echo $width $height
width=`expr $width - $x - 9`
height=`expr $height - $y - 26`
#	echo $width $height
mv $jpeg $old
pnmcut $x $y $width $height $ppm | cjpeg > $jpeg
rm $ppm
----snip here----

-- 
kevin at suberic.net                              Nutrition Facts
fork()'ed on 37058400		       Puns: 100% RDA  (% good puns: 0)




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell