Active Topics

 


Reply
Thread Tools
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#11
Well, I whacked up a script to convert an image to pdf and launch xournal; then you edit it and save as a pdf, then it converts it back. It's too dumb and simple and useless to post yet, if you have imagemagick and xournal, you know how to do it already,

Things missing:
Camera photo grabbage: Anyone know how to do this from a script? No? Hmmm.....
Mailing: Probably requires DBUS work, should be workable, I just don't know how.

Things you may not like:
Uses ImageMagick (that requires like 30 MB to install)
You have to export as pdf with a specific name, which it does not have as a default value.

I've got a plan on how to rectify both of those... it should be out later in the week.
I've no clue on the photo-taking or emailing end, beyond what I wrote. Any advice is appreciated.
 
RogerS's Avatar
Posts: 772 | Thanked: 183 times | Joined on Jul 2005 @ Montclair, NJ (NYC suburbs)
#12
Originally Posted by Benson View Post
Well, I whacked up a script to convert an image to pdf and launch xournal; then you edit it and save as a pdf, then it converts it back. It's too dumb and simple and useless to post yet, if you have imagemagick and xournal, you know how to do it already,
...
I've no clue on the photo-taking or emailing end, beyond what I wrote. Any advice is appreciated.
This sounds like more than a little start. I say, Worry about the emailing later.

And on the N810, you're going to have to stop and look at the picture you took before you decide you got what you intended (unlike the N800, where you should be able to see that you at least framed the subject properly). So implementing this as a second step in a process instead of an everything-in-one-package-starting-from-the-camera-click might be better anyway.

Post soon!
__________________
N900 Guide Brief intro to the Nokia N900 (http://n900guide.com/)
Maemoan since July 2005 )
 
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#13
Originally Posted by RogerS View Post
This sounds like more than a little start. I say, Worry about the emailing later.

And on the N810, you're going to have to stop and look at the picture you took before you decide you got what you intended (unlike the N800, where you should be able to see that you at least framed the subject properly). So implementing this as a second step in a process instead of an everything-in-one-package-starting-from-the-camera-click might be better anyway.

Post soon!
Well, I was figuring on aim-n-pray anyhow; I assumed whatever scriptable tool probably won't have video preview. But I suppose you could use whatever camera tool, then have the script grab (by default) the last image taken...

E-mail is probably easy for someone, so I was gonna post without and let them patch it.

What's tying me up right now is { pdf | ppm } -> jpeg conversion (other than ImageMagick; I'm trying to eliminate that dependency). Also, it'd be nice to get rotation by 90 degrees; we can check if xrandr is present, and if so, rotate according to screen alignment. But that won't hold up an initial release.

If I can't get that in a couple days at worst, I'll release a script that saves as .pdf only.

ps My apologies for the flurry of posting and unposting. Microb was on crack.
 
Posts: 118 | Thanked: 297 times | Joined on Nov 2007
#14
Originally Posted by Benson View Post
Well, I was figuring on aim-n-pray anyhow; I assumed whatever scriptable tool probably won't have video preview.
Maybe the Easy python API is something to look into for this kind of project? Looks promising...
 

The Following User Says Thank You to anders_gud For This Useful Post:
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#15
Thanks, but I don't python. Well, maybe if I have to I could kludge something together from examples, but I could probably get a C program to do it easier.
 
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.
 
Posts: 178 | Thanked: 40 times | Joined on Aug 2007 @ UK
#17
lol, I like the example image :-)))
 
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#18
OK, just realized I left the instructions out of the previous post, as I sat down to post this one... But here's a new version that uses the camera via easy. I warn, it's not really anywhere close to finished; but it works, so try it.

Instructions:
Installation:
Dependencies:
  • easy
  • 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.
Installation proper:
Place cheezburgr_snap.py in /home/user/apps. Or, if you put it elsewhere, edit cheezburgr.sh.
Place cheezburgr.sh somewhere executable, such as /home/user/apps.
Make both files executable

Running:
Capturing new image:
Code:
cheezburgr.sh
Yep, put that one in cmd-navigator, personal menu, osso-statusbar-cpu, or powerlaunch.
Or run it from an xterm, see if I care.

The screen will come up with a squashed video preview, a resolution selector, and a click button. Clicky-click click, and it takes a picture, and exits that window, and seems to be doing nothing while it converts the image and launches xournal. Xournal comes up, you make your changes as you see fit, and then you have to choose export as pdf, and click OK without changing the filename. Close xournal now (no point saving), and your image arrives in MyDocs/.images/.
From existing image:
Code:
cheezburgr.sh image.jpg
Yes, it's jpeg only right now; that can be fixed easily, but isn't done yet. Otherwise, it's similar to the latter portions snapshot mode.

Todo
  • Rotation detection
    Yes it's easy, no it's not done yet. This will also take care of camera flipover on the N800...
  • E-mail
    Obviously, we need to go through dbus for this; I don't really know what I'm doing there, so count me out. (If I had to do it, I'd probably make pine a dependency )
  • Chance to preview (& discard) multiple shots before submitting one to Xournal
    Sorry N810 users; buy a hand-mirror, or find someone who doesn't despise python to fix things up.
  • Aspect ratio of preview
    Sorry, everyone; ditto.
  • Full-screen for capture tool?
    ditto, but a curved hand-mirror.
  • Make saving from Xournal less complex
    Hmmmm.... Not happening?
    Sorry, I know this isn't user friendly, but I can't see the requisite changes to Xournal happening. Maybe some other app is more suitable, but xournal's all I know that's good for both text and scrawling.
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#19
Originally Posted by Benson View Post
E-mail
Obviously, we need to go through dbus for this; I don't really know what I'm doing there, so count me out. (If I had to do it, I'd probably make pine a dependency )
dbus-send --print-reply --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.MailTo string:mailto:mail@me.!

(dbus-monitor isn't hard to use but I see this post is old so I wouldn't be surprised if you have already added dbus know-how to your very wide unix knowledge )

Ah, that just opens a new mail window, not add an attachment. Sorry.

Last edited by qwerty12; 2009-01-14 at 19:22.
 

The Following User Says Thank You to qwerty12 For This Useful Post:
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#20
Originally Posted by Benson View Post
Camera photo grabbage: Anyone know how to do this from a script? No? Hmmm....
You can use gst-launch from a shell script to capture images from the camera.

I have an example videocam line in this post, but a few tweaks would take a jpg picture instead. This also automatically handles rotation-detection.

EDIT: Where are your scripts (cheezburgr.sh and cheezburgr_snap.py), Benson? I can't seem to find them in your posts anywhere.
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!

Last edited by qole; 2009-01-14 at 20:17.
 
Reply


 
Forum Jump


All times are GMT. The time now is 21:30.