Is it possible to scan an image from the command line?
I don't know of a way to do it with built in tools, but there is an OS X version of SANE that should be able to do exactly what you request (scanimage > image.pnm).

SANE


  This is a TWAIN datasource for MacOS X that aquires images using the SANE backend libraries. The SANE backend libraries provide access to a large range of scanners connected through SCSI or USB. For a complete list see the documentation on the SANE project homepage.


It's available at http://www.ellert.se/twain-sane/