Dancing Kayak - FreeBSD - Scanner Setup

Here are the details on how to setup a scanner on FreeBSD (based on 4.10 and 5.3) on a machine

How I Set up My Scanner

My scanner (Epson Perfection 640U) has a USB interface, so I'll only talk about USB interface setup.

For comprehensive background information, see the SANE web site and the man pages for the SANE programs (once you install the SANE backend).

  1. Get a root shell.
  2. Ensure the kernel recognizes the usb scanner device (/dev/uscanner0). Do this by grep us /var/run/dmesg.boot if these aren't there, you are stuck, or you may have to upgrade to FreeBSD 4.10 (or 5.3), since that's the first time I recall seeing the scanner messages in my dmesg.boot file.
  3. Ensure you have the port graphics/sane-backends installed. If you use KDE, you may want to build with the flag WITH_GPHOTO2=yes defined.
  4. Once you install this port, you can read the man pages for sane-find-scanner and scanimage.
  5. Run sane-find-scanner and see if your scanner is detected in the scan. Record the information if so. For example, for my scanner, the vendor code is 0x04b8 and the product code is 0x010c.
  6. If the default configuration file at /usr/local/etc/sane.d/epson.conf doesn't support sane picking up the scanner just by the usb or scsi statements, put the information in the appropriate configuration file at /usr/local/etc/sane.d/epson.conf
  7. Run scanimage -L to see the entry for your scanner.
  8. You should be able to run scanimage --device-name epson:/dev/uscanner0 >filename to scan whatever is on the scanner and write the contents to a file.
  9. Useful options on scanimage include:

Once you are set up, you can try this as a non-root user. Run sane-find-scanner as a non-root user; if the program can't see the scanner, you need to change the permissions on the scanner device. The SANE man pages specify what to do.

  1. Add a group called scanner to /etc/group.
  2. # chgrp scanner /dev/uscanner0
  3. # chmod 660 /dev/uscanner0
  4. Add any users you want to run the scanner to the scanner group.

Converting a scanned photograph to a JPEG image in the GIMP (2.2)

  1. Scan the photo(s) as described above - this takes a long time, much longer than it would on Windows with Epson's Windows drivers (sigh).
  2. Launch the GIMP
  3. Open the (huge - 100 MB) scan file, which is likely in PNM format (unless you chose the option --format tiff)
  4. Select the rectangular region selection tool
  5. Select the rectangular region containing the scanned photo
  6. Select the Image->CropImage menu item
  7. Select the Image->ScaleImage menu item
  8. In the Scale Image dialog, select a reasonable resolution like 400 width (the height will adjust to maintain the aspect ratio), choose Cubic Interpolation, and click the Scale button
  9. Select the View->Zoom menu choice to choose a higher zoom since reducing resolution in the previous step will make the image look small in the large scale selected for the original image
  10. Select File->SaveAs, click on the Select File Type choice, select JPEG, name the file what you want, click Save
  11. When the jpeg-specific dialog appears, select 90% and leave the advanced options as they are

Converting a JPEG image to a PDF

Use the convert utility program supplied in ImageMagick.

convert inputfile.jpeg outputfile.pdf


Back to FreeBSD main page