View Single Post
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#16
On the other hand, I guess easy does make it easy. I still don't know or want to learn python, but the camera snapshot example looks simple, and with a little down-stripping, useful for this. Maybe I'll give that a shot later... or someone else can, if they get impatient.

But here's a script:
Code:
#!/bin/sh
jpegtopnm -exif=/home/user/tmp.cheezburgr.exif $1 >/home/user/tmp.cheezburgr.ppm

echo '<?xml version="1.0" standalone="no"?>' >/home/user/tmp.cheezburgr.xoj
echo '<xournal version="0.4.1">' >>/home/user/tmp.cheezburgr.xoj
echo '<title>Xournal document - see http://math.mit.edu/~auroux/software/xournal/</title>' >>/home/user/tmp.cheezburgr.xoj
echo '<page width="'`pamfile /home/user/tmp.cheezburgr.ppm |cut -f2 |cut -f3 -d' '`'" height="'`pamfile /home/user/tmp.cheezburgr.ppm |cut -f2 |cut -f5 -d' '`'">' >>/home/user/tmp.cheezburgr.xoj
echo '<background type="pixmap" domain="absolute" filename="/home/user/tmp.cheezburgr.ppm" />' >>/home/user/tmp.cheezburgr.xoj
echo '<layer>' >>/home/user/tmp.cheezburgr.xoj
echo '</layer>' >>/home/user/tmp.cheezburgr.xoj
echo '</page>' >>/home/user/tmp.cheezburgr.xoj
echo '</xournal>' >>/home/user/tmp.cheezburgr.xoj

xournal /home/user/tmp.cheezburgr.xoj
if [ ! -e /home/user/MyDocs/tmp.cheezburgr.pdf ] ; then
  rm /home/user/tmp.cheezburgr*
  exit
fi
rm /home/user/tmp.cheezburgr.ppm
pdftoppm -f 1 -l 1 -r 72 /home/user/MyDocs/tmp.cheezburgr.pdf /home/user/tmp.cheezburgr
rm /home/user/MyDocs/tmp.cheezburgr.pdf
pnmtojpeg -exif=/home/user/tmp.cheezburgr.exif /home/user/tmp.cheezburgr-*.ppm >$1_edited.jpg
rm /home/user/tmp.cheezburgr*
Now the dependencies:
  • Xournal (from repos, check http://www.gronmayer.com/it/)
  • netpbm (Maemo build not available, as far as I can tell)
  • libnetpbm10 (Maemo build not available, as far as I can tell)
I'm using netpbm (&c.) from Debian Lenny:
http://packages.debian.org/lenny/armel/netpbm/download
http://packages.debian.org/lenny/arm...pbm10/download
But the dependencies aren't new enough!
Seemed to work fine with: (as root, of course)
Code:
dpkg -i --force-depends-version netpbm_10.0-11.1_armel.deb libnetpbm10_10.0-11.1_armel.deb
No guarantees, of course, but it seems to work fine. And much smaller than imagemagick.

Oh, and in case you don't notice, no handling of rotation yet. But it should be pretty easy.
Attached Images
 

Last edited by Benson; 2008-04-03 at 04:35.