<!doctype linuxdoc system>
<article>
<title> SANE-outline-JP
<author> 川岸 良治 &lt; <url url="mailto:kawagisi@yk.rim.or.jp"
                                   name="kawagisi@yk.rim.or.jp"> &gt; <newline>
 &lt; <url url="http://www.yk.rim.or.jp/~kawagisi/"> &gt;
<date> 第2版 1999年7月13日作成
<abstract> この文書は、スキャナ用 API の規格である SANE の概要と、そのパッ
           ケージの使い方を簡単に紹介したものです。
</abstract>

<sect> はじめに
<p>
<quote>
  この文書は、スキャナ用 API の規格である SANE の概要と、そのパッケージの
  使い方を簡単に紹介したものです。SANE のホームページや SANE のパッケージ
  に付属のドキュメントには、非常に多くの情報がありますが、このドキュメント
  では SANE に興味を持った初心者が最初に知りたいと思うであろう SANE のイン
  ストール、使い方など必要最小限のものにとどめています。
<p>
  SANE に関して書かれたものとして、以下のようなものがあります。
<p>
  ■ SANE のホームページ <url url="http://www.mostang.com/sane/">
<quote>
     FAQ <newline>
     Tutorial <newline>
     Programmer's Manual <newline>
     など <newline>
     開発者向けのメーリングリストもあります。
</quote>
  ■ XSANE のホームページ 
     <url url="http://www.wolfsburg.de/~rauch/sane/sane-xsane.html">
<p>
  ■ SANE に関する日本語のドキュメント一覧
<p>
<quote>
   (1) SANE-outline-JP (このドキュメント)
<quote>
       SANE のインストール、使い方など。
</quote>
   (2) SANE-tutorial-JP
<quote>
       Linux Journal Issue 47, March 1998 に載った SANE を紹介した文献で
       SANE のホームページで "Tutorial" として公開されているものを翻訳。
       JF &lt; <url url="http://www.linux.or.jp/JF/"> &gt; にあります。
</quote>
   (3) 「Software Design」 1999年7月号34頁 「Linux で画像作成」樋口 千洋著
<newline>
   (4) 「gimp入門」 三浦 一則著、(株)毎日コミュニケーションズ刊      <newline>
   (5) 「THE GIMP FOR LINUX」 渡辺裕一、古俣信行共著、エーアイ出版刊 <newline>
   (6) 「GIMP パーフェクトガイド」 Michael J.Hammel著／豊福 剛 訳、
       エムディエヌコーポレーション刊
<p>
       (3)〜(6) は何れも GIMP の解説の中で SANE のインストール、GIMP のプラ
       グインとしての使い方などを紹介しています。
</quote>
  ■ SANE も含め Linux で使える各種スキャナ用ソフトを紹介したドキュメント
     として "Scanner-HOWTO-INDEX" が JF
     &lt; <url url="http://www.linux.or.jp/JF/"> &gt; にあります。
</quote>

<sect> SANE とは何か
<p>
(SANE のホームページの Introduction より)
<p>
<quote>
<!--
  SANE stands for "Scanner Access Now Easy" and is an application 
  programming interface (API) that provides standardized access to any 
  raster image scanner hardware (flatbed scanner, hand-held scanner, 
  video- and still-cameras, frame-grabbers, etc.). 
-->
  SANE は `Scanner Access Now Easy' の略で、フラットベッドスキャナ、ハンド
  ヘルドスキャナ、ビデオカメラ、スチルカメラ、フレームグラバ(画面キャプチャ)
  等のようなラスター・イメージスキャナ・ハードウェアへのアクセスを標準化した
  API (Application Programming Interface)です。
<p>
  スキャナのインタフェースとして Windows の TWAIN がよく知られています。
  TWAIN はデバイスドライバとユーザインタフェースが一体であるのに対して
  SANE では分離されていて、ドライバを Backend、ユーザインタフェースを 
  Frontend と呼んでいます。
<p>
<!--
  While SANE is an acronym for ``Scanner Access Now Easy'' the hope is of 
  course that SANE is indeed sane in the sense that it will allow easy 
  implementation of the API while accommodating all features required by 
  today's scanner hardware and applications. 
-->
  SANE は `Scanner Access Now Easy' の頭文字ではあるが、今日のスキャナハード
  ウェアとアプリケーションに要求される全ての機能を提供する API の実装が容易
  にできるという意味で、希望はもちろん SANE は確かに sane である (正気の、考
  え方の健全な、良識ある、分別ある)ということです。 
</quote>

(SANE のホームページの Tutorial より)
<quote>
<!--
  Suppose we wanted five applications to support ten different devices. 
  With the old approach, 5*10=50 programs would have to be written. With 
  SANE, only 5+10=15 programs have to be written. SANE has advantages for
  the user too. It gives the user the liberty to choose whichever 
  application he likes best, and that one application can be used to 
  control all image-acquisition devices the user can access. Thus, SANE 
  makes it possible to present the same consistent interface independent 
  of the particular device that is in use. 
-->
  10 台の異なるデバイスをサポートする、5 種類のアプリケーションが欲しいと
  します。古いアプローチでは、5×10=50 で 50 ものプログラムを書かなければな
  りませんが、SANE では 5+10=15 で 15 のプログラムを書くだけでよいのです。
  SANE はユーザにもメリットがあります。ユーザは自分が最も好きなアプリケー
  ションを選択する自由が得られ、ユーザがアクセス可能な全ての画像取込みデバ
  イスを制御するために使用できます。つまり SANE は、使用中の特定のデバイス
  に同じ一貫したインタフェースの独立性を与えてくれるのです。
<p>
  また、SANE ではコマンドラインのインタフェースや、ネットワーク経由の
  スキャンもサポートしています。
<p>
  SANE は、GPL(GNU General Public License) のもとで配布されています。
<p>
  対応するプラットホームは以下の通りです。<newline>
<quote>
  AIX,            <newline>
  Digital Unix,   <newline>
  FreeBSD,        <newline>
  HP Apolo Domain/OS, <newline>
  HP-UX,          <newline>
  IRIX,           <newline>
  Linux (Alpha, m68k, PPC, SPARC, x86), <newline>
  NetBSD, <newline>
  OpenStep/m68k,  <newline>
  OpenStep/x86,   <newline>
  OS/2, <newline>
  SCO OpenServer, <newline>
  Solaris/Intel,  <newline>
  Solaris/SPARC,  <newline>
  SunOS/SPARC
</quote>
</quote>

<sect> Backend と Frontend

<sect1> SANE の Backend がサポートするデバイス
<p>
<quote>
      SANE の パッケージに含まれる Backend (ドライバ) がサポートする機器は
      現時点で以下のようなものがあります。これにはαテスト段階のドライバや
      デジタルカメラ等スキャナ以外のものも含まれています。
<p>
      (SANE のホームページの Supported Scanners より)
<verb>
  ---------------------------------------------------------------
  メーカ        モデル
  ---------------------------------------------------------------
  Abaton        Scan 300/GS, Scan 300/S
  AGFA          Focus GS Scanner, Focus Lineart Scanne, Focus II,
                Focus Color,      Focus Color Plus
                Arcus II, StudioScan II, StudioScan IIsi
                SnapScan 300, SnapScan 310, SnapScan 600,
                SnapScan 1236s
  Apple         Apple Scanner, OneScanner, ColorOneScanner
  Artec/Ultima  AT3, A6000C, A6000C PLUS, AT6, AT12
  BlackWidow    BW4800SP
  Canon         CanoScan 300, CanoScan 600, CanoScan 2700F
  Connectix     QuickCam
  (dll)         Dynamic loading of shared-library backends.
  Epson         GT-5500, GT-7000
  Escom         Image Scanner 256
  HP            HP ScanJet Plus,
                HP ScanJet IIc, HP ScanJet IIp, HP ScanJet IIcx,
                HP ScanJet 3c,  HP ScanJet 4c,  HP ScanJet 6100C,
                HP ScanJet 3p,  HP ScanJet 4p,  HP ScanJet 5p,
                HP ScanJet 6200C, HP ScanJet 6250C,
                HP PhotoSmart PhotoScanner
  Kodak         DC210, DC25, DC20
  Linotype Hell Jade, Jade2, Saphir, Saphir2, Saphir Ultra, 
                Saphir Ultra II, Saphir HiRes, Opal, Opal Ultra
  Microtek      Scanmaker E6,   Scanmaker E3,  Scanmaker E2,
                Scanmaker 35t+, Scanmaker III, Scanmaker IISP,
                Scanmaker IIHR, Scanmaker IIG, Scanmaker II
                Scanmaker 600Z(S), Scanmaker 600G(S)
                ScanMaker V300,    ScanMaker V310, ScanMaker V600,
                ScanMaker E3plus,  ScanMaker X6,   ScanMaker X6EL,
                ScanMaker 330,     ScanMaker 630,  ScanMaker 636
                ScanMaker 9600XL,  Phantom 636
  Mustek        MFC-600S,   MFC-600CD, MFS-6000CX, MFS-6000SP,
                MFS-8000SP, MFC-800S,  MFS-1200SP, MFS-12000CX,
                SE-6000SP,  SE-12000SP
  (net)         Network access to saned servers
  Nikon         LS-20, LS-1000, AX-210
  PINT          PINT デバイスドライバを使用したスキャナ
  Plustek       Plustek 4830, Plustek 9630, Plustek OpticPro 600
  (pnm)         Reads PNM files
  Polaroid      DMC
  Connectix     QuickCam
  Qtronix       Sagitta Gray, Sagitta Color
  Ricoh         ??
  Siemens       S9036, ST400
  Sharp         JX-610, JX-250, JX-330
  Tamarack      Artiscan 6000C, Artiscan 8000C, Artiscan 12000C,
  UMAX          Vista S6, Vista S6E, UMAX S-6E, UMAX S-6EG,
                Vista-S8, Supervista S-12, UMAX S-12, UMAX S-12G,
                Astra 600S, Astra 610S, Astra 1200S, Astra 1220S,
                UC 630, UG 630, UG 80, UC 840, UC 1200S,
                UC 1200SE, UC 1260, Mirage , Mirage II,
                Mirage IIse, Vista-T630, PSD, Powerlook,
                Powerlook III, PL-II, Powerlook 2000, 
                Powerlook 3000, Gemini D-16
  Vobis         HighScan
  Vobis/Highscreen  Scanboostar Premium
  Vuego         310S
</verb>
      上記以外にも計画中 (planned) 作成中 ("wip" work-in-progress の略) の
      ものがいくつかあります。詳しくは sane パッケージの PROJECTS というファ
      イル、および doc ディレクトリ以下にある sane-???.man を御覧下さい。
<p>
      dll および net は、仮想デバイスドライバです。詳しくは SANE のホームペー
      ジにある Tutorial の "4  How Does It Work?" をご覧下さい。
</quote>

<sect1> Frontend
<p>
<quote>
    SANE の Backend と組み合わせて使用できる Frontend(ユーザインタフェース)
    として以下のようなものがあります。
<p>
    (SANE のホームページの Supported Scanners より)
<p>
    (1) scanimage
<quote>
   コマンドライン上で動作する。SANE のパッケージに含まれる。
</quote>
    (2) xscanimage
<quote>
  X 上で動作する。SANE の パッケージに含まれる。<newline>
</quote>
    (3) xsane
<quote>
       X 上で動作する。xscanimage をベースに機能追加したもの。<newline>
       <url url="http://www.wolfsburg.de/~rauch/sane/sane-xsane.html">
</quote>
    (4) Gimp 
<quote>
       xscanimage または xsane をプラグインとして使用する。
</quote>
    (5) xcam
<quote>
        デジタルカメラ用。SANE のパッケージに含まれる。
</quote>
    (6) saned
<quote>
     リモートスキャン用の SANE ネットワークデーモン。SANE のパッケージに
     含まれる。
</quote>
</quote>

<sect> パッケージの入手と展開
<sect1> パッケージの入手先
<p>
<quote>
 (1) SANE のホームページ
<quote>
         <url url="http://www.mostang.com/sane/">
</quote>
 (2) SANE のソースパッケージは、下記にあります。
<quote>
     ここには、tar.gz 形式のソースがあります。このドキュメントの作成時点
     での最新版は <newline>
         sane-1.0.1.tar.gz   21,Apr,1999  (973 KB) <newline>
     です。
<p>
     公式サイト： <newline>
         <url url="ftp://ftp.mostang.com/pub/sane/">    (USA)     <newline>
         <url url="ftp://ftp.de.mostang.com/pub/sane/"> (Germany) <newline>
         <url url="ftp://ftp.no.mostang.com/pub/sane/"> (Norway)  <newline>
<p>
     ミラーサイト： <newline>
         <url url="ftp://tsx-11.mit.edu/pub/linux/packages/sane"> <newline>
         <url url="ftp://metalab.unc.edu/pub/Linux/apps/graphics/capture/">
<newline>
         <url url="ftp://ftp.u-aizu.ac.jp/pub/misc/device/scsi/scanner/sane/">
</quote>
 (3) SANE のバイナリパッケージは、下記にあります。<newline>
<quote>
     RPM 形式 <newline>
         <url url="http://rufus.w3.org/linux/RPM/sane.html">
<p>
     DEB 形式 <newline>
         <url url="http://www.debian.org/Packages/unstable/graphics/sane.html">
<p>
     OS/2 用 <newline>
         <url url="http://www.quasarbbs.com/yuri/sane2.html">
</quote>
</quote>

<sect1> パッケージの展開
<p>
<quote>
 (1) tar.gz 形式のソースパッケージは、次のようにして展開します。
<quote>
         &dollar; su <newline>
         &num; cd /usr/local/src <newline>
         &num; tar zxvf &tilde;/sane-x.x.x.tar.gz <newline>
<p>
     上記は &tilde;/ ディレクトリにある sane-x.x.x.tar.gz を /usr/local/src
     ディレクトリ以下に展開する場合です。
     それ以外の時はそのディレクトリに合わせて変えてください。
</quote>
 (2) RPM 形式、DEB 形式のバイナリパッケージは、それぞれの方法で展開します。
</quote>

<sect> インストール
<p>
<quote>
  ソースパッケージを展開したら以下のようにしてインストールします。
  バイナリパッケージの場合は、下記のビルド等の処理は不要です。
</quote>

<sect1> 必要なもの
<p>
      (README より)
<quote>
    SANE をビルドするには以下のものが必要ですから確認しておきましょう。
<p>
    ■ GNU make: バージョン 3.70 またはそれより新しいもの。 <newline>
      【訳注】 &dollar; make -v でバージョンを確認できます。 <newline>
<p>
    ■ ANSI C コンパイラ: GNU C (gcc)  <newline>
<p>
    ■ グラフィカルなフロントエンド (xscanimage と xcam) をビルドするには
       GTK ライブラリ(libgtk, libgdk, libglib) と間連するヘッダーファイルが
       インストールされている必要があります。 <newline>
<p>
    ■ Gimp から xscanimage を呼び出して使いたい場合は、さらに libgimp
       (バージョン 0.99.13 またはそれ以上)と間連するヘッダーファイルが
       インストールされている必要があります。
<p>
      【訳注】これらのライブラリがインストールされているかどうかは 
              /usr/lib を見れば分かります。
<p>
    GTKライブラリと Gimp は下記から入手できます。<newline>
          <url url="ftp://ftp.gimp.org/pub/">
</quote>

<sect1> Configuration
<p>
      (README より)
<quote>
    SANE のトップディレクトリ(先程の例では /usr/local/src/sane-X.XX)に移り
    コンフィグレーションのスクリプトを実行します。<newline>
<p>
        &num; cd /usr/local/src/sane-X.XX <newline>
        &num; ./configure <newline>
<!--
    Besides the usual GNU configure options, there are the following SANE
    specific options:
-->
<p>
    通常の GNU configure オプションに加えて下記の SANE 固有のオプションが
    あります。
<p>
     --disable-shared
<!--
        Don't use shared libraries.  Useful for debugging or when there
        is a problem building shared libraries.  This implicitly turns
        on - -disable-dynamic as well.
-->
<quote>
        シェアード(共有)ライブラリを使用しない。デバッグ時または、シェアー
        ドライブラリのビルドに問題がある場合に有効です。これは暗黙的に
        --disable-dynamic もオンにします。
</quote>
     --disable-dynamic
<!--
        Disable dynamic loading of backends (in the dll backend).
        configure normally turns on dynamic loading when it
        can find the appropriate header files and libraries
        (<dlfcn.h> and -dl).
-->
<quote>
        (dll backend の中の)バックエンドをダイナミックローディングしない
        ようにします。通常 configure は適切なヘッダーファイルとライブラリ
        (&lt;dlfcn.h&gt; と -dl)を見つけることができる場合はダイナミック
        ローディングをオンにします。
</quote>
     --enable-preload
<!--
        Preload backends into DLL backend.  This is useful for debugging,
        when dynamic loading is unavailable, or to reduce runtime linking
        overheads.  If dynamic loading or shared libraries are unavailable
        or disabled, this option is turned on automatically.
-->
<quote>
        DLL バックエンドにバックエンドをプリロードします。これはダイナミッ
        クローディングを利用できない場合のデバッグ、または実行時のリンクの
        オーバーヘッドを減らすのに役立ちます。ダイナミックローディング、ま
        たはシェアードライブラリが利用できないか、ディスエーブルになってい
        る場合、このオプションは自動的にオンになります。
</quote>
     これらの SANE-specific オプション以外にも標準のオプションがたくさん
     あります。どんなオプションがあるかは
      --help
     オプションで分かります。
<p>
     デバッグする場合は下記のように configure を実行することを推奨します。
<newline>
     &num; CFLAGS="-g -O -Wall" ./configure --disable-shared
<p>
     【訳注】 PROBLEMS というファイルを読んでおくようにというメッセージが
              表示されます。何らかのトラブルが起こる前に一度目を通しておく
              と良いでしょう。
</quote>

<sect1> ビルド、インストール、設定
<p>
       (README より)
<quote>
     &num; make <newline>
     &num; make install
<p>
     デフォルトでは、これで各ファイルが次のディレクトリに置かれます。<newline>
         /usr/local/lib/        ：SANE のライブラリ <newline>
         /usr/local/etc/sane.d/ ：設定ファイル <newline>
         /usr/local/man/        ：マニュアルページ
<p>
     これとは別の所に置きたい場合は、configure のオプションで変更できます。
<p>
     設定、トラブルシューティング、SANE の各コンポーネントに関する情報は
     以下のマニュアルページを御覧下さい。
<p>
<verb>
  -------------------  --------------------------------
  scanimage            scanimage(1)
  xscanimage           xscanimage(1)
  saned                saned(1)
  xcam                 man-page はありません。
                       frontend/xcam.README を参照。
  -------------------  --------------------------------
  Abaton   スキャナ    sane-abaton
  AGFA     スキャナ    sane-agfafocus
  Apple    スキャナ    sane-apple
  EPSON    スキャナ    sane-epson
  HP       スキャナ    sane-hp(5)      sane-scsi(5)
  MICROTEK スキャナ    sane-microtek   sane-microtek2
  Mustek   スキャナ    sane-mustek(5)  sane-scsi(5)
  PINT     スキャナ    sane-pint(5)
  Polaroid スキャナ    sane-dmc
  Sharp    スキャナ    sane-sharp
  UMAX     スキャナ    sane-umax(5)    sane-scsi(5)
  -------------------  --------------------------------
  Dynamic loading      sane-dll(5)
  Networking           sane-net(5)     saned(1)
  QuickCam カメラ      sane-qcam(5)
  Kodak    カメラ      sane-dc25
  frontend デバッグ用  sane-pnm
  -------------------  --------------------------------
</verb>
<!--
    Please note that the default configuration uses sane-dll as the
    top-level backend.  Hence it is probably a good idea to start with
    reading sane-dll(5).  The top-level backend is determined by the
    libsane.* symlinks in /usr/local/lib/.
-->
    デフォルトの設定では、トップレベルのバックエンドとして sane-dll を
    使うという点に注意してください。ですから sane-dll(5) を読みながら始める
    というのは良い考えです。トップレベルのバックエンドは /usr/local/lib/
    の libsane.* へのシンボルリンクによって決定されます。
</quote>

<sect> find-scanner と scanimage で動作確認
<p>
<quote>
    【訳注】SCSI スキャナの認識
<p>
         SCSI ホストアダプタ用のローレベルの SCSI カーネルドライバと、
         genelic (汎用) SCSI ドライバがモジュールとしてコンパイルされている
         なら、スキャナの電源を ON してから、ドライバモジュールをロードしま
         す。そうでなければ、スキャナの電源を ON してから、システムをリブー
         トする必要があります。
         スキャナがシステムに認識されているかは、次のようにして確認できます。
<verb>
  $ cat /proc/scsi/scsi
  Attached devices: 
  Host: scsi0 Channel: 00 Id: 06 Lun: 00
    Vendor:          Model: Scanner          Rev: 1.80
    Type:   Scanner                          ANSI SCSI revision: 02
</verb>
    【訳注終り】
<p>
    (README より)
<p>
<!--
    If you are not sure what generic SCSI device your scanner is connected
    to, try the command tools/find-scanner.  It is normally sufficient to
    invoke the program without any arguments.  Invoking this command
    should produce output similar to this:
-->
    接続されているスキャナの SCSI デバイス名が分からない場合は tools ディレ
    クトリにある find-scanner コマンドを試してみましょう。
    通常は、引数無しでプログラムを起動すればよいでしょう。このコマンドを
    起動すると下記とよく似た出力が得られる筈です。
<p>
<verb>
  &num; tools/find-scanner
  find-scanner: found "MUSTEK MFC-06000CZ 1.01" at device /dev/scanner
  find-scanner: found "MUSTEK MFC-06000CZ 1.01" at device /dev/sge
</verb>
<p>
   【訳注】私の Microtek ScanMaker E3 での例
<p>
    &num; tools/find-scanner <newline>
    で、<newline>
    find-scanner: found scanner " Scanner 1.80" at device /dev/sga <newline>
    と表示され、スキャナが /dev/sga に接続されていることを認識しました。
<newline>
    これを /dev/scanner にリンクします。
<p>
    &num; ln -s /dev/sga /dev/scanner
<p>
    次に利用可能なデバイス名を表示させます。
<verb>
  &num; scanimage -L
  device `microtek:/dev/scanner' is a Microtek ScanMaker E3 flatbed scanner
  device `microtek:/dev/sga' is a Microtek ScanMaker E3 flatbed scanner
</verb>
<p>
    この場合 microtek:/dev/scanner がデバイス名です。<newline>
    【訳注終り】
<p>
<!--
    If you encounter any problems with getting your device(s) recognized,
    try setting the various environment variables that are there to assist
    in debugging such problems.  The environment variables are documented
    in the relevant manual pages.  For example, to get the maximum amount
    of debug information when testing a Mustek scanner, set environment
    variables SANE_DEBUG_DLL, SANE_DEBUG_MUSTEK, and SANE_DEBUG_SANEI_SCSI
    to 128 and then invoke scanimage or whatever program you're trying to
    debug.  For a Mustek scanner at /dev/scanner, you might want to invoke
    scanimage as follows:
-->
    デバイスの認識で何らかの問題が起きた場合、それらの問題のデバッグを助ける
    ための色々な環境変数の設定を試して下さい。環境変数は関連するマニュアルペ
    ージに記述されています。例えば、Mustek のスキャナをテストする際に Mustek
    のスキャナのデバッグに関する最大量の情報を得るには SANE_DEBUG_DLL,
    SANE_DEBUG_MUSTEK, SANE_DEBUG_SANEI_SCSI 環境変数を128 にセットしてから
    scanimage (または、デバッグしようとする全てのプログラム)を起動してくだ
    さい。
<p>
    /dev/scanner に Mustek のスキャナがある場合、scanimage を起動するには
    下記のようにします。
<p>
    &num; scanimage -d mustek:/dev/scanner -h
<p>
<!--
    If this works, you could try to acquire an image with:
-->
    これがうまくいけば次のようにして画像を取り込むことができます。
<p>
    &num; scanimage -d mustek:/dev/scanner > t.pnm
<p>
   【訳注】一般ユーザもスキャナにアクセスできるようにするには？
<p>
       特に設定をしなければ、
<p>
<verb>
  &num; ls -l /dev/sga
  crw-------   1 root   root   21,   0 Jul 19  1994 /dev/sga
</verb>
<p>
       のように一般ユーザはアクセスできないようになっていると思います。
       これを
<p>
<verb>
  &num; chmod 666 /dev/sga
  &num; ls -l /dev/sga
  crw-rw-rw-   1 root   root   21,   0 Jul 19  1994 /dev/sga
</verb>
<p>
       のようにすれば一般ユーザも使用できるようになります。
<p>
    【訳注終り】
</quote>

<sect> xscanimage
<p>
<sect1> xscanimage を単独で使用する
<p>
<quote>
    scanimage コマンドでスキャナが動作することが確認できたら、X 上で
    xscanimage を使ってみましょう。
    xscanimage は、プレビュー機能およびスキャナから取り込んだ画像を PNM フォ
    ーマット (PBM:白黒2階調画像、PGM:グレースケール、PPM: カラー の3つのフォ
    ーマットの総称)でセーブする機能があります。これらは xscanimage 単独でも
    動作しますし、後述のように Gimp などのプラグインとして呼び出して使うことも
    できます。起動は、
<p>
      &dollar; xscanimage デバイス名 &
<p>
    と入力します。または引数無しで、単に
<p>
      &dollar; xscanimage &amp;
<p>
    で、利用可能なデバイスを一覧表示したウィンドウが表示されるので、その中から
    選択します。コマンドのオプション、設定ファイルの内容など詳しくは、
<p>
      &dollar; man xscanimage
<p>
    でマニュアルを御覧ください。
</quote>

<sect1> メニューの日本語化
<p>
<quote>
    Gimp を始め GTK+-1.0.x を使ったアプリケーションでは GtkConv というパッチ
    をあてることによりメニューの文字列を各国語に変換することが簡単にできます。
    英語アプリの文字列をどのように変換するかを定義したファイルを作成して
    menu.xxxx というファイル名で &tilde;/.gtk ディレクトリに置くだけです。
    xxxx の部分は、そのアプリと同じ名前にします。従って Gimp の場合は 
    &tilde;/.gtk/menu.gimp で xscanimage の場合は、
    &tilde;/.gtk/menu.xscanimage となります。また GTK+-1.0.x を使ったアプリ
    全般に共通の内容を定義したmenu.default もあります。
    現在使用している Gimp が既に GtkConv で日本語化されている場合は、
    menu.xxxx の内容を参考にするとよいでしょう。
    英語の文字列と日本語の文字列を TAB で区切るというのがポイントです。
    TAB で始まる行は、行末までコメントになります。
<p>
    なお、GTK+-1.2.x では I18N (国際化)されているので、上記の方法による
    メニューの日本語化がうまくいくかどうかは分かりません。
    インストール済みの GTK＋ のバージョンは、次のようにすれば表示されます。
<p>
        &dollar; gtk-config --version
<p>
    詳しくは下記 GtkConv のホームページをご覧下さい。<newline>
        <url url="http://www.hi-ho.ne.jp/~asura/menu/gtk.html">
<p>
    参考までに私が作った &tilde;/.gtk/menu.xscanimage ファイルの内容を
    示します。
<p>
<code>
	-*-coding: euc-japan -*-
	Time-stamp: <99/06/03 02:15:29 kawa>
	Copyright (C) 1999 Ryoji Kawagishi <kawagisi@yk.rim.or.jp>

Preferences		設定
Show advanced options	詳細オプションを表示
Show tooltips		ツールチップスを表示
Length unit		長さの単位
millimeters		ミリメートル
centimeters		センチメートル
inches			インチ
Preview options...	プレビューオプション...
Save device settings	デバイス設定を格納
Restore device settings	デバイス設定を読込む

Output			出力
Filename		ファイル名
Scan Mode		スキャンモード
Scan mode		スキャンモード
Color			カラー
Gray			グレイ
Halftone		中間調
LineArt			ラインアート
Scan resolution [dpi]	スキャン解像度[dpi]
Expanded Resolution	Expanded 解像度
Scan speed		スキャン速度

Enhancement		エンハンスメント
Exposure [%]		露出 [%]
Brightness [%]		明るさ [%]
Contrast [%]		コントラスト [%]
White level		白レベル
Black level		黒レベル
Midtone Level		中間調レベル

Gamma Control		ガンマ制御
Gamma Control Mode	ガンマ制御モード
None			無し
Scalar			スカラ
Table			テーブル
How to specify gamma correction, if at all	ガンマ補正の指定方法

Geometry		ジオメトリ
Top-left x [cm]		左上 x [cm]
Top-left y [cm]		左上 y [cm]
Bottom-right x [cm]	右下 x [cm]
Bottom-right y [cm]	右下 y [cm]
Top-left x [mm]		左上 x [mm]
Top-left y [mm]		左上 y [mm]
Bottom-right x [mm]	右下 x [mm]
Bottom-right y [mm]	右下 y [mm]
Top-left x [in]		左上 x [インチ]
Top-left y [in]		左上 y [in]
Bottom-right x [in]	右下 x [in]
Bottom-right y [in]	右下 y [in]

Scan			スキャン
Preview Window		プレビュー窓
</code>
</quote>

<sect> Gimp で SANE(xscanimage)を使う
<p>
(xscanimage の man ページより)
<quote>
<!--
  To run xscanimage under the gimp(1), simply copy it to one of the 
  gimp(1) plug-ins directories.  If you want to conserve disk-space, 
  you can create a symlink instead. For example, the command
-->
  Gimp の下で xscanimage を実行するには、xscanimage を Gimp の plug-ins 
  ディレクトリの一つにコピーするだけです。ディスクスペースを大切に使いたい
  なら、その代わりに symlink(シンボリックリンク) を作ることもできます。
  例えば、以下のコマンド：
<p>
      &dollar; ln -s @BINDIR@/xscanimage &tilde;/.gimp/plug-ins/
<p>
<!--
  adds  a  symlink  for  the xscanimage binary to the user's
  plug-ins directory.  After creating this symlink, xscanim-
  age will be queried by gimp(1) the next time it's invoked.
  From  then  on,  xscanimage   can   be   invoked   through
  "Xtns->Acquire Image->Device dialog..." menu entry.
-->
  は、xscanimage のバイナリ用の symlink をユーザの plug-ins ディレクトリに
  追加します。この symlink を作成すると、次回 Gimp を起動した時に xscanimage
  は Gimp から問い合わせがあります。それ以降 xscanimage は
  "Xtns -> Acquire Image -> Device dialog..." メニューエントリを通して
  起動されます。
<p>
  【訳注１】上記のコマンドは具体的には、例えば <newline>
      &dollar; su <newline>
      &num; ln -s /usr/local/bin/xscanimage &tilde;/.gimp/plug-ins/ <newline>
    のようになります。
<p>
  【訳注２】メニューの "Xtns -> Acquire Image" は、 <newline>
    日本語化された Gimp では "拡張 -> 画像読取り" と表示されます。
<p>
  【訳注終り】
<p>
<!--
  You'll  also find that the "Xtns->Acquire Image" menu con-
  tains short-cuts to the SANE devices that  were  available
  at  the time the xscanimage was queried.  For example, the
  first PNM pseudo-device  is  typically  available  as  the
  short-cut "Xtns->Acquire Image->pnm:0".  Note that gimp(1)
  caches these short-cuts in ~/.gimp/pluginrc.   Thus,  when
  the list of available devices changes (e.g., a new scanner
  is installed), then it is typically desirable  to  rebuild
  this  cache.   To  do  this,  you  can either touch(1) the
  xscanimage binary (e.g., "touch  @BINDIR@/xscanimage")  or
  delete  the  plug-ins cache (e.g., "rm ~/.gimp/plug-ins").
  Either way, invoking gimp(1)  afterwards  will  cause  the
  pluginrc to be rebuilt.
-->
  "Xtns -> Acquire Image" メニューの中に、xscanimage がクエリーされたときに
  利用できる SANE デバイスへのショートカットがあることに気付くでしょう。
  例えば最初の PNM 疑似デバイスは典型的に "Xtns -> Acquire" "Image -> pnm:0" 
  ショートカットとして利用できます。Gimp はこれらのショートカットを 
  &tilde;/.gimp/pluginrc で見つけるという点に注意して下さい。
  従って、利用できるデバイスのリストを変更（例えば新しいスキャナをインスト
  ール）した場合、一般的にはこのキャッシュを再構築することが望ましいです。
  それには、xscanimage バイナリを touch でタイムスタンプを変更する、例えば
<p>
      &dollar; touch  @BINDIR@/xscanimage
<p>
  のようにするか、または plug-ins キャッシュを削除、例えば
<p>
      &dollar; rm &tilde;/.gimp/plug-ins
<p>
  とします。
  いずれの方法でも、その後 Gimp を起動した際に pluginrc が再構築されます。
<p>
  【訳注３】 
    touch は指定したファイルのアクセス時刻（access time) と修正時刻
    （modificaion time）を現在の時刻に変更するコマンドです。
    指定したファイルが存在しない場合は、空のファイル(サイズが０)を新規に
    作成します。［JMAN の日本語マニュアルページより引用］
<p>    
  【訳注４】 
     xscanimage コマンドのオプション、設定ファイルの内容など詳しくは、
        &dollar; man xscanimage
    でマニュアルを御覧下さい。
</quote>

<sect>  xsane
<sect1>  特徴
<p>
  (xsane のホームページより)
<quote>
  xsane は、X でSANE を使うための新しい Frontend (GUI) です。
  Xsane には、以下の動作モードがあります。
<p>
    (1) Scan モード (スタンドアロン) <newline>
<!--
           The scan mode is to scan an image and save it to a file. 
-->
<quote>
           scan モードは、画像をスキャンしファイルにセーブします。<newline>
</quote>
    (2) Gimp プラグイン <newline>
<!--
           If xsane is started as Gimp plugin, the scanned image
           automatically is transfered to the Gimp. 
-->
<quote>
           Gimp プラグインモードの場合、スキャンした画像は自動的に
           Gimp に転送されます。 <newline>
</quote>
    (3) Copy モード <newline>
<!--
           In Copy mode, the scanned image is converted to postscript. 
           The postscript file is piped as standard input to the command
           listed after the printer symbol. 
-->
<quote>
           Copy モードの場合、スキャンした画像はポストスクリプト形式に
           変換されます。ポストスクリプトファイルは、プリンタシンボルの
           後にリストされたコマンドに標準入力としてパイプされます。 <newline>
</quote>
    (4) Fax モード <newline>
<!--
           This mode is a Frontend for SANE and for a faxprogram like
           hylafax or mgetty+sendfax 
-->
<quote>
           Fax モードは、SANE 用の Frontend であり、hylafax または
           mgetty+sendfax のようなファクスプログラム用です。
</quote>
</quote>

<sect1> 入手
<p>
<quote>
  下記から xsane-0.28.tar.gz を入手します。<newline>
  <url url="http://www.wolfsburg.de/~rauch/sane/sane-xsane.html">
<p>
  xsane を使用するには gtk-1.0.x または 1.2.x と glib がインストールされ
  ている必要があります。また xsane を Gimp のプラグインとして使う場合は、
  gtk-1.2.x と gimp-1.0.4 を使用することを推奨します。
</quote>

<sect1> 必要なもの
<p>
     (xsane のホームページより)
<quote>
<!--
    sane-1.0 or newer installed - I suggest sane-1.0.1
        if you installed sane as rpm, you also need the sane-devel-rpm to
        compile xsane!
    gtk-1.0.x or 1.2.x and glib installed
    If you like to use xsane and gimp, I suggest to use at least gtk-1.2.x,
        and gimp-1.0.4
        it also work with gimp-1.1.3 (tested with SuSE-6.1)
    for jpeg support: jpeglib
    for png support:  lipng and libzlipng
    for tiff support: libtiff
    gcc compiler (tested with gcc-v2.7.2.3 and gcc-egcs-1.1.2), don`t use 
         g++/c++ compilers
-->
<p>
    ■ sane-1.0 または、それ以上。sane-1.0.1 を推奨。
<quote>
       sane を rpm でインストールしている場合、xsane をコンパイルするには
       sane-devel-rpm も必要です。
</quote>
    ■ gtk-1.0.x または 1.2.x と glib がインストールされていること
<quote>
       xsane と Gimp を使用したい場合は、gtk-1.2.x 以上と gimp-1.0.4 を推奨
       します。gimp-1.1.3 でも動作します(SuSE-6.1 でテスト済)
</quote>
    ■ jpeg サポート: jpeglib <newline>
    ■ png  サポート: lipng と libzlipng <newline>
    ■ tiff サポート: libtiff <newline>
    ■ gcc コンパイラ(gcc-v2.7.2.3 と gcc-egcs-1.1.2 でテスト済) 
       g++/c++ コンパイラは使わないこと。
</quote>

<sect1> コンパイルとインストール
<p>
<quote>
    (1) アーカイブを展開します。
<quote>
        &dollar; tar zxvf xsane-x.xx.tar.gz
</quote>
    (2) 展開したディレクトリに移動します。
<quote>
        &dollar; cd xsane-x.xx
</quote>
    (3) コンパイルし、make します。
<quote>
        &dollar; ./configure <newline>
        &dollar; make
</quote>
    (4) root になって、インストールします。
<quote>
        &dollar; su <newline>
        &num; make install
</quote>
</quote>

<sect1> 起動と日本語化
<p>
<quote>
     &dollar; xsane &
<p>
     と入力します。
<p>
     Gimp の plug-in として使うには、下記のように xsane のバイナリの
     シンボリックリンクをユーザの plug-ins ディレクトリに追加します。
<p>
     &dollar; ln -s /usr/local/bin/xsane &tilde;/.gimp/plug-ins/
<p>
     Gimp のメニューで "Xtns -> Acquire Image -> Device dialog..." を
     選択すると xsane が起動されます。
<p>
     メニューの日本語化は、xscanimage と同様です。xscanimage の日本語化に
     関する説明を参考にして &tilde;/.gtk/menu.xsane を作成して下さい。
</quote>

<sect1> うまくいかない場合
<p>
     (xsane のホームページより)
<quote>
<!--
    If you get an error message that libsane-dll.so.1 is not found,
    you have to tell your system where the SANE-libraries are installed. 

    For linux: edit /etc/ld.so.conf and add a line with the path
        to the libraries (normally /usr/local/lib/sane), then call 
        ldconfig as root. 
    For some SuSE-linux-distributions: edit /etc/ld.so.conf.in and add 
        a line with the path to the libraries 
        (normally /usr/local/lib/sane), then call SuSEconfig as root. 
-->
    ■ libsane-dll.so.1 が見つからないというエラーメッセージが出る場合
<quote>
       SANE ライブラリがどこにインストールされたのかを、システムに教える必要
       があります。linux の場合 /etc/ld.so.conf を編集し、ライブラリのパス
       (通常 /usr/local/lib/sane)を書いた行を追加してから、root 権限で
           &num; ldconfig
       を実行します。
<p>
       SuSE-linux ディストリビューションの場合、/etc/ld.so.conf.in を編集し
       ライブラリにパス(通常 /usr/local/lib/sane)を教える行を追加します。
       次に、ルート権限で SuSEconfig をコールします。
</quote>
<!--
    The online-help-viewer is now selectable. If you use kde you can enter 
    kdehelp in setup/display. Preselected is netscape with usage of remote 
    commands. On some SuSE systems there only is "Netscape" and no 
    "netscape" in the path, in  this case you have to set a symbolic link: 
-->
    ■ オンライン・ヘルプビューアを選択できます。
<quote>
       KDE を使用している場合は 
       setup/display の kdehelp が使えます。あらかじめ選択されているのは、
       リモートコマンドの使い方が付いた netscape です。SuSE システムでは、
       パスの中にあるのは "netscape" ではなく "Netscape" となっているものが
       あります。このような場合、下記のようにシンボリックリンクを張る必要が
       あります。
<p>
       &num; ln -s /usr/bin/Netscape /usr/bin/netscape
<p>
   【訳注】日本語化した Netscape で起動コマンドが
       /usr/local/bin/jcommunicator となっている場合、上記と同様に
<p>
       &num; ln -s /usr/bin/jcommunicator /usr/bin/netscape
<p>
       とします。
       また、事前に Netscape Communicator を起動しておく必要があります。
   【訳注終り】
</quote>
<!--
    If you have problems compiling xsane and you get the following errors:
-->
    ■ xsane のコンパイルで下記のようなエラーが出た場合：
<quote>
       /usr/lib/libgimp.so: undefined reference to `g_debug'   <newline>
       /usr/lib/libgimp.so: undefined reference to `g_message' <newline>
       /usr/lib/libgimp.so: undefined reference to `g_warning' <newline>
       /usr/lib/libgimp.so: undefined reference to `g_error'   <newline>
<p>
<!--
    Then you updated gtk but did not update gimp to the right version:
    Update gimp to at least 1.0.4
-->
       これは gtk をアップデートしたけれど、Gimp を正しいバージョンに
       しなかったのです。Gimp を 1.0.4 以上にアップデートしましょう。
</quote>
</quote>

<sect> この文書について
<p>
<quote>
  この文書は
<quote>
    (1) SANE のホームページ <url url="http://www.mostang.com/sane/"> <newline>
    (2) sane-1.0.1.tar.gz パッケージ内のドキュメント
        (README, xscanimage の man ページ) <newline>
    (3) xsane-0.28.tar.gz パッケージ内のドキュメント
</quote>
  から、その一部を引用、翻訳し、加筆したものです。
  引用および翻訳については SANE プロジェクトの了承を得ました。
<p>
  履 歴：
<quote>
     第1版 1999年7月 7日 <newline>
     第2版 1999年7月13日 &tilde; が空白になってしまうのを修正。
                         &lt;url&gt; タグの記述方法を修正。
</quote>
<p>
  版権等： 引用した元の文書と同様に、この文書も 
           GPL(GNU General Public License) に従います。<newline>
<p>
  謝  辞：この文書の校正に際し、以下の JF メンバーの方からアドバイスを頂き
          ました。有難うございます。
<quote>
          早川 　仁さん &lt; uv9h-hykw@asahi-net.or.jp &gt; <newline>
          中野 武雄さん &lt; nakano@apm.seikei.ac.jp   &gt; <newline>
          岡本 一幸さん &lt; ikko-@pacific.rim.or.jp   &gt;
</quote>
  連絡先： この文書の誤り等の指摘、質問、改良に関する提案、ご意見等は
           Ｒ．川岸 &lt; <htmlurl url="mailto:kawagisi@yk.rim.or.jp"
                          name="kawagisi@yk.rim.or.jp"> &gt; <newline>
           または JF プロジェクト
           &lt; <htmlurl url="mailto:JF@linux.or.jp"
                               name="JF@linux.or.jp">&gt; 宛にお願いします。
</quote>
</article>
