About "A Taste of Smalltalk"

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Fri Oct 4 19:57:22 UTC 2002


On Fri, 4 Oct 2002, Jason Rogers wrote:

> That's a pretty laborious process though.  Is there any good way to
> automate the cropping?

Of course. I use pnmtools all the time. They do an incredible job at this
kind of stuff. Typing a command line to convert some images takes a lot
less time than to start The Gimp, at least on my machine. Here's a simple
command line to convert all jpeg images in a directory to postscript,
converting everything to pure black/white (to save space) and cropping 100
pixels around:

for f in *.jpg ; do djpeg $f|ppmtopgm|pgmtopbm -threshold|pnmcut -left 100
-right -100 -top 100 -bottom -100 | pnmtops -noturn > 
`basename $f .jpg`.ps ; done

You could throw in some other nifty stuff like (-scale option for 
pnmtops), automatic removal of all white border (pnmcrop).

This can also easily be followed by

	cat *.ps > t.ps
	ps2pdf t.ps

Doing this for t000.jpg to t028.jpg (downloaded per wget) results in a 1
MB PDF, which is not too bad at 30 k/page, IMO. See
http://isgwww.cs.uni-magdeburg.de/~bert/t.pdf

-- Bert




More information about the Squeak-dev mailing list