OS/2 eZine - http://www.os2ezine.com
Spacer
16 June 2001
 
Author Photo Marco J. Shmerykowsky, P.E. is a professional structural engineer and computer consultant in New York City with SCE/Shmerykowsky Consulting Engineers and SCE Computer Solutions.

If you have a comment about the content of this article, please feel free to vent in the OS/2 eZine discussion forums.

There is also a Printer Friendly version of this page.

Spacer
Previous Article
Home
Next Article


Relish Personal Information Manager - http://www.sundialsystems.com/relishhome


Scanning with Sane

In recent years the popularity and ease of creating and using digital photographs has increased. Digital cameras have become a great tool for recording images from a field visit or event. Simply snap the picture and download it to a floppy disk or flash memory chip. Nothing could be simpler.

Certain applications, however, still require the use of "pre-digital camera" tools. For example, most paper publications require that electronic photographs be submitted at a scanned resolution of 300 DPI. Typically, the files need to be saved in a TIFF format also. The average digital camera doesn't comply with these requirements. There is also that vast collection of traditional photographs which we need to use in the development of articles, brochures, and a host of other business documents. These images also require the use of our older tools in order to enter the digital work flow.


The workhorse of this "pre digital camera" era is the good old scanner. If you use OS/2, chances are pretty good that you have struggled with getting this particular piece of hardware working properly with your operating system. The main problem centered around the fact that OS/2 does not come with the required drivers necessary to operate a scanner, and the scanners only come with software that will run in Windows. To make matters worse, the majority of Windows programs that have been coming with scanners for the past couple of years are based on Win32 and will not run under OS/2.

The most common answer I heard in response to my original question on scanning with OS/2 was "don't even bother, just use Windows." This was coming from dedicated OS/2 users who had obviously passed their frustration tolerance limits. Another solution was to attempt to use a Win16 application using Win-OS2. This just didn't seem the right thing to do on OS/2. I wanted another solution.

Finally, I purchased True Spectra Photo Graphics Pro 2.0 which came with the Twain consumer driver pack from Solution Technologies. It was a native set of tools and it worked. The problem, however, is that over time this solution has stopped working properly. Since 1997 when I purchased the program, my OS/2 system has undergone continual upgrades with Fixpacks and program updates. With all these changes, the Twain drivers have stopped working as seamlessly as they're supposed to. Currently, I can only do a single full color scan each time I launch PMView. After scanning one photo, I need to save the image and close down PMView and then relauch the program to start the next scanning procedure. If you get into a rhythm, then it's not that bad. It's also, however, far from the ideal of "smooth" scanning.

Usually when I'm placed in a vexing situation, the simple thought "there has got to be a better way to do this" pops into my head. One night after a large number of scans, I decided to start looking for that better way. One option with I came across that has potential is the OS/2 port of SANE.

SANE, which was originally developed for use on Unix based system such as the increasingly popular Linux, stands for "Scanner Access Now Easy." In general. it is an application programming interface that provides standardized access to any raster image scanner hardware. This application programming interface or API is subject to the GNU General Public License and consequently is available to the programmers in the open source community. As with many open source unix utilities, there is an OS/2 port of the command line scanning program plus a few front-end programs. For the purposes of my testing, I used an Epson ES-1000C scanner and the dedicated Adaptec 152X SCSI adapter which came with the scanner. I also tried both the version 1.01 port by Yuri Dario and the version 1.03 port by Dr. Paul Floyd.

Installation

The installation process for SANE is very straightforward once you collect some additional pieces. In addition to the port of SANE, you need to obtain the latest EMX runtime and the file ASPIROUT.SYS. According to the documentation that comes with the ports, the build level of the EMX runtime needs to be at "0.9D fix 2" for version 1.01 and "0.9D fix 3" for version 1.03. You also need to install the correct driver for your scsi adapter and add the ASPI driver, which should already be located in your OS2\BOOT directory, to your config.sys file with the following syntax: "BASEDEV=OS2ASPI.DMD"

In order to run SANE you need to unzip the binary archive and choose the appropriate .conf file for you scanner. In my case, I copied the epson.conf file from the /sane/conf directory to the /sane/bin directory. At this point you need to reboot in order to ensure that all of the device drivers have been properly initialized. At this point scanning starts to get easy.

In order to test that SANE is properly functioning, drop into a command prompt, switch over to the "/bin" directory of where you installed the program and run "find-scanner." The program should return something similar to find-scanner: found processor "EPSON SCANNER GT-8500 1.26" at device b0t2l0. Next type "scanimage -L" at the command line. Scanimage is the backbone of this scanning tool. The "-L" option tells the program to show the available scanner devices. On my system, for example, the command returns the following information:

device `epson:b0t2l0' is a Epson GT-8500 flatbed scanner
device `pnm:0' is a Noname PNM file reader virtual device
device `pnm:1' is a Noname PNM file reader virtual device

If you're unable to get this information to pop up and you are sure that the proper device drivers have been installed, then the problem most likely lies in your configuration settings.

Scanning in Images

Once "scanimage" is functioning properly, you can start scanning images using the numerous command line switches to adjust the quality and size of your scan. For example, to create a low resolution, black and white scan of an image using the full area of the scanner table enter: scanimage -d epson > G:\junk\sane-sample2.pnm The "-d epson" parameter specifies which device to use and the last portion redirects the output to a file. The "*.pnm" file type is a "portable anymap" file which is capable of storing PBMPlus files created by Jef Poskanzer's PBMPlus Portable Bitmap Utilities. According to the help files included with PMView 2000 the PBMPlus files are common on Unix platforms. Since this is a port of a Unix program, the resulting file format is not surprising. Once the file is created, you can use your favorite image editing tool to load, trim, and resave the scanned image. I used PMView 2000 for OS/2 and had no problems with reading and manipulating the resulting *.pnm file. An example of this "default" quick scan can be seen below. It is a scan of a Lynard Skynard compact disk I had lying around.

The next step is to create higher quality scans for use in publications and brochures. In order to accomplish this, one needs to use some of the many switches or options which are present in the scan-image program. For example, I used the same album cover and added the switches "--mode color" and "--resolution 200" to the previously listed command line sequence. The result can be seen in below.

One warning: you should have plenty of available disk space when making large, high quality scans. The scan of the 8-1/2" x 11" table area at a resolution of 200 dpi generated an 11 megabyte .pnm file. Once the same file was resaved as a .jpg file at 75% quality, the file size decreased to 256 kilobytes.

In addition to the few switches I mentioned, the scanimage program has a number of other switches which will give the user control over the quality and size of the scan. These options include "gamma correction," "halftoning," "color correction," "brightness," "sharpness", and "size." In general, you have the same functionality which is available in the current set of available commercial tools.

GUI Front-Ends

The only thing that is missing is access to a graphical user interface (GUI). Even though the command line sequence when combined with a tool such as PMView is fairly straightforward, it is understandable that some users would like a GUI based program. Fortunately for those users there are a few different tools at various levels of development which meet their needs.

Tame/2

One of the better tools seems to be "Tame/2." This program is installed by unzipping its contents into the /bin directory where the main SANE binary executables are located.

The tool essentially provides a graphical spin on the setting of the command line parameters. The resulting scan is still sent to a file and a image viewing utility is required to view the resulting image.

Josi Scanlite

Another interesting tool which popped up in the mailing lists and newgroups is the Josi Scanlite program.

On the surface, this program is similar to the Tame/2 frontend in that it provides a graphical interface to SANE's command line options. The main difference is that Scanlite will also display and preview the scan. Furthermore, it is written using Java and Swing. The net result is a very clean looking application the runs acceptably.

Running the Scanlite program requires a few additional configuration settings. The "localhost" address must be defined in the TCP/IP settings on your workstation, a TCP port number must be added to the "services" file in the "/etc" directory, and "saned" - the network scanner dameon - must be configured. Once this is accomplished, you must start saned in one command prompt by typing "saned -d" Please note that the -d switch is required for the scanning device to be properly recognized. The final step is to launch the Java program by typing "java -classpath josiscanlite.jar;jimi.jar;%CLASSPATH% JosiScanLite" You will need to have both Java 1.1.8 and the Swing libraries installed for the program to work properly.

The version I tested was the "free" version. As such the program only allows for images to be saved using the JPEG format. The developers are planning to release a commercial version called 'Scan pro' which will support a variety of output formats such as png, bmp, pcx, pict, psd, xbm, and tga. The only problem that I noticed with the test version was that the area selected for a final scan on the "preview" page did not appear to register with the program. Consequently, the whole scanning bed would be covered during a final scan.

Summary

In conclusion, the SANE set of tools are a realistic replacement for the commercially available scanning tools for OS/2. SANE isn't perfect, but it does work well when coupled with a quality image viewer like PMView. Furthermore, you can't beat the price. Many thanks to the developers who created the program and ported it to OS/2.

Resources

SANE Home Page: http://panda.mostang.com/sane/
Using SANE with OS/2: http://paulf.free.fr/sane-os2.html
Josi ScanLite: http://www.objects.com.au/products/josi/scanlite/
All other components are available at hobbes.nmsu.edu

Previous Article
Home
Next Article

Copyright (C) 2001. All Rights Reserved.