newrisedesigns has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a q&d Perl script to acquire an image from my webcam, modify it, and upload it to my website.
The resizing and uploading features work flawlessly, however in order to acquire the image, the camera (via TWAIN) requires that I "Select", "Capture" then "Transfer" the image, a process that takes four clicks. This kills the possibility of allowing the camera to run continuously; it will halt when I'm not there and drive me completely insane when I am.
As far as I know, I have only three options.
- Find a different module (I'm using Win32::Scanner::EZTWAIN) that acquires without human intervention
- Have an intermediary program acquire the image and place it in a file (the same as above, but non-Perl)
- Automate the button pushing somehow (four mouse clicks, options would not change)
Fellow Monks, which of the above seems like a viable and readily instituted solution?
Code follows...
use Win32::Scanner::EZTWAIN; use Net::FTP; use Image::Magick; my $scanner = new Win32::Scanner::EZTWAIN(); print "Select Image Source...\n"; $scanner->select_image_source(""); print "Acquiring File...\n"; $scanner->acquire_to_file("cam.bmp"); my $image = new Image::Magick; print "Opening Image\n"; $image->Read("cam.bmp"); $image->Resize(width=>320, height=>240, filter=>"Cubic"); $image->Annotate(text=>'newrisedesigns.com', font=>"Verdana", pointsize=>12, fill=>"#000000", antialias=>"true", x=>17, y=>20); $image->Annotate(text=>'newrisedesigns.com', font=>"Verdana", pointsize=>12, fill=>"#ffffff", antialias=>"true", x=>15, y=>18); if($ARGV[0] ne ''){ $ARGV[0] .= "\n"; $image->Annotate(text=>$ARGV[0], font=>"Verdana", pointsize=>12, stroke=>"#000000", strokewidth=>1, antialias=>"true", gravity=>"South"); } $image->Set(quality=>80); print "Reformatting Image\n"; $image->Write(filename=>"cam.jpg", compression=>'jpeg'); my $ftp = Net::FTP->new("website.com"); print "Preparing FTP Connection\n"; $ftp->login('username','password'); print "Changing Directory\n"; $ftp->cwd('httpdocs/cam'); print "Putting Image\n"; $ftp->binary(); $ftp->delete('cam.jpg'); $ftp->put('cam.jpg');
Any solutions other than the three above would also be greatly appreciated.
Many thanks,
John J Reiser
newrisedesigns.com
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: TWAIN Issues and Perl
by ryddler (Monk) on Sep 12, 2002 at 15:34 UTC | |
by Mr. Muskrat (Canon) on Sep 12, 2002 at 17:34 UTC | |
by Anonymous Monk on Apr 14, 2010 at 21:32 UTC | |
Re: TWAIN Issues and Perl
by Mr. Muskrat (Canon) on Sep 12, 2002 at 14:45 UTC | |
Re: TWAIN Issues and Perl
by t'mo (Pilgrim) on Sep 12, 2002 at 15:35 UTC | |
by da (Friar) on Sep 13, 2002 at 18:31 UTC | |
by t'mo (Pilgrim) on Sep 13, 2002 at 21:33 UTC | |
Re: TWAIN Issues and Perl
by samtregar (Abbot) on Sep 12, 2002 at 06:31 UTC | |
by newrisedesigns (Curate) on Sep 12, 2002 at 12:14 UTC | |
Re: TWAIN Issues and Perl
by BrowserUk (Patriarch) on Sep 13, 2002 at 03:41 UTC | |
by newrisedesigns (Curate) on Sep 18, 2002 at 16:47 UTC | |
by BrowserUk (Patriarch) on Sep 18, 2002 at 18:03 UTC | |
Re: TWAIN Issues and Perl
by grantm (Parson) on Sep 13, 2002 at 02:22 UTC |