これは、NetBSD Advent Calendar 2020の9日目の記事です。
はじめに
IPP Everywhereに対応したEPSON EW-M752Tというカラーインクジェットプリンターと書いていましたが、 正確にはスキャナー機能もついた複合機です。 このスキャナー機能も、独自のスキャナーデバイスドライバーを利用せずにApple AirScanやWSDという仕組みでスキャンできるようです。 今回は、pkgsrc/graphics/sane-airscanを使ってスキャンしてみます。
pkgsrc/graphics/sane-airscanをインストールする
以下のようにインストールします。 sane-airscanは、SANE (pkgsrc/graphics/sane-backends)というUnix-like OSで一般的なスキャナーを扱う仕組みのバックエンドです。
# cd /usr/pkgsrc/graphics/sane-airscan # make install
スキャナーを認識させる
scanimageコマンドでスキャナーを一覧表示させることができます。 以下のように認識されました。 avahiデーモンも起動しておく必要があります。
# /etc/rc.d/avahidaemon start $ scanimage -L device `epson2:net:10.81.0.149' is a Epson PID flatbed scanner device `airscan:e1:EPSON EW-M752T Series' is a eSCL EPSON EW-M752T Series ip=10.81.0.149
airscanというのが今回利用しようとしているデバイスです。これで利用できるオプションも調べておきましょう。
$ scanimage --help -d airscan
Usage: scanimage [OPTION]...
Start image acquisition on a scanner device and write image data to
standard output.
Parameters are separated by a blank from single-character options (e.g.
-d epson) and by a "=" from multi-character options (e.g. --device-name=epson).
-d, --device-name=DEVICE use a given scanner device (e.g. hp:/dev/scanner)
--format=pnm|tiff|png|jpeg file format of output file
-i, --icc-profile=PROFILE include this ICC profile into TIFF file
-L, --list-devices show available scanner devices
-f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the output
can be specified: %d (device name), %v (vendor),
%m (model), %t (type), %i (index number), and
%n (newline)
-b, --batch[=FORMAT] working in batch mode, FORMAT is `out%d.pnm' `out%d.tif'
`out%d.png' or `out%d.jpg' by default depending on --format
This option is incompatible with --output-file. --batch-start=# page number to start naming files with
--batch-count=# how many pages to scan in batch mode
--batch-increment=# increase page number in filename by #
--batch-double increment page number by two, same as
--batch-increment=2
--batch-print print image filenames to stdout
--batch-prompt ask for pressing a key before scanning a page
--accept-md5-only only accept authorization requests using md5
-p, --progress print progress messages
-o, --output-file=PATH save output to the given file instead of stdout.
This option is incompatible with --batch.
-n, --dont-scan only set options, don't actually scan
-T, --test test backend thoroughly
-A, --all-options list all available backend options
-h, --help display this help message and exit
-v, --verbose give even more status messages
-B, --buffer-size=# change input buffer size (in kB, default 32)
-V, --version print version information
Options specific to device `airscan':
Standard:
--resolution 100|200|300|600|1200dpi [300]
Sets the resolution of the scanned image.
--mode Color|Gray [Color]
Selects the scan mode (e.g., lineart, monochrome, or color).
--source Flatbed [Flatbed]
Selects the scan source (such as a document-feeder).
Geometry:
-l 0..215.9mm [0]
Top-left x position of scan area.
-t 0..297.18mm [0]
Top-left y position of scan area.
-x 0..215.9mm [215.9]
Width of scan-area.
-y 0..297.18mm [297.18]
Height of scan-area.
Enhancement:
--brightness -100..100% (in steps of 1) [0]
Controls the brightness of the acquired image.
--contrast -100..100% (in steps of 1) [0]
Controls the contrast of the acquired image.
--shadow 0..100% (in steps of 1) [0]
Selects what radiance level should be considered "black".
--highlight 0..100% (in steps of 1) [100]
Selects what radiance level should be considered "white".
--analog-gamma 0.0999908..4 [1]
Analog gamma-correction
--negative[=(yes|no)] [no]
Swap black and white
Type ``scanimage --help -d DEVICE'' to get list of all options for DEVICE.
List of available devices:
epson2:net:10.81.0.149 airscan:e1:EPSON EW-M752T Series
特に、スキャンモードはカラーがグレースケールしかないので注意してください。
スキャンしてみる
TIFFファイルにカラーでスキャンしてみるには、以下のようにします。
$ scanimage --format=tiff -d airscan --mode Color > color-scanned.tiff
TIFFファイルにグレースケールでスキャンしてみるには、以下のようにします。
$ scanimage --format=tiff -d airscan --mode Gray > grayscale-scanned.tiff
スキャンした画像も、素直な感じなので常用できそうです。
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。