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).
- Get a root shell.
- 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.
- 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.
- Once you install this port, you can read the man pages for
sane-find-scanner and scanimage.
- 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.
- 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
- Run scanimage -L to see the entry for your scanner.
- 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.
- Useful options on scanimage include:
- --mode [Color|Binary|Gray]
where Binary is the not-very-useful default
- --resolution [75|150|300|600],
where 75 is the default,
- --preview [yes|no], where no is the default,
- --format [pnm|tiff], where pnm is the default.
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.
- Add a group called scanner to /etc/group.
- # chgrp scanner /dev/uscanner0
- # chmod 660 /dev/uscanner0
- 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)
- 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).
- Launch the GIMP
- Open the (huge - 100 MB) scan file, which is likely in PNM
format (unless you chose the option --format tiff)
- Select the rectangular region selection tool
- Select the rectangular region containing the scanned photo
- Select the Image->CropImage menu item
- Select the Image->ScaleImage menu item
- 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
- 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
- Select File->SaveAs,
click on the Select File Type
choice, select JPEG, name the file what you want,
click Save
- 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