LoginSignup
3
5

More than 1 year has passed since last update.

Linuxでドキュメントスキャナーを使う方法 (SANE)

Posted at

Linuxでドキュメントスキャナーを使うには

大きく分けて2つの方法があります。
1つ目はWineでWindows用スキャナドライバーを動作させる。
2つ目にSANEを使用する。

です。今回はSANEを使用してみます。

SANEとは

saneとはScanner Access Now Easyの略称で、どのドキュメントスキャナでも同じコマンドや使い方でスキャンできるように開発されたツールです。(正気という意味ではないです。)普通Windowsなどでスキャンを行う際は公式サイトに行きWindows用アプリケーションインストーラーをダウンロードして、インストールして使用するのが一般的ですが、saneを使うとほぼすべてのスキャナを使用することができます。今回は一例としてバックエンド(CUI)で動作させてみますが、フロントエンドのアプリケーションをインストールすることでGUIで操作することも可能です。設定項目が非常に多く、カスタマイズ性が高いと思います。(難しいと思いますが、gscan2pdfは非常にわかりやすいUIでした。)

  • インストール
Terminal
$ sudo pacman -S sane

これでインストール完了です。
スキャナをUSBで接続したあと、認識しているかどうかをチェックします。

Terminal
$ scanimage -L
device `fujitsu:ScanSnap iX500:3871' is a FUJITSU ScanSnap iX500 scanner

きちんと認識されているとスキャナの表示がでます。
もしない場合は

$ sane-find-scanner
  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.
  # Also you need support for SCSI Generic (sg) in your operating system.
  # If using Linux, try "modprobe sg".

could not open USB device 0x8087/0x8000 at 002:002: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0002 at 002:001: Access denied (insufficient permissions)
could not open USB device 0x8087/0x8008 at 001:002: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0002 at 001:001: Access denied (insufficient permissions)
found USB scanner (vendor=0x04c5 [Fujitsu], product=0x132b [ScanSnap iX500]) at libusb:004:006
could not open USB device 0x05e3/0x0626 at 004:005: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0003 at 004:001: Access denied (insufficient permissions)
could not open USB device 0x0bda/0x0158 at 003:005: Access denied (insufficient permissions)
could not open USB device 0x0a6b/0x000f at 003:003: Access denied (insufficient permissions)
could not open USB device 0x30fa/0x0400 at 003:019: Access denied (insufficient permissions)
could not open USB device 0x046d/0xc345 at 003:018: Access denied (insufficient permissions)
could not open USB device 0x0a05/0x7211 at 003:017: Access denied (insufficient permissions)
could not open USB device 0x0bda/0x8152 at 003:014: Access denied (insufficient permissions)
could not open USB device 0x05e3/0x0610 at 003:012: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0002 at 003:001: Access denied (insufficient permissions)
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.

  # You may want to run this program as root to find all devices. Once you
  # found the scanner devices, be sure to adjust access permissions as
  # necessary.

接続されているか確認してください。

スキャン

Terminal
$ scanimage > {ファイル名}.png

で完了です。
フォーマット指定したいときは

$ scanimage --format="pdf" > test.pdf 

のようにオプションを渡すとできます。
またvpのオプションをつければちゃんと動作しているか確認できます。

Terminal
$ sudo scanimage --format=png > ~/test.png -vvv -p
scanimage: scanning image of size 5096x6600 pixels at 1 bits/pixel
scanimage: acquiring gray frame
scanimage: read 4204200 bytes in total
Closing device
Calling sane_exit

出力後は%が見えませんが、スキャン中は%も表示されます。

これで一通りスキャンはできると思います。お疲れ様でした。

3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5