http://qs1969.pair.com?node_id=197122

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.

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