Ghostscript のビルド
現行バージョン 9.16 の Ghostscript で tiffscaled4 tiffscaled8 tiffscaled24 tiffscaled32 を使用するには、
Ghostscript のソースから再ビルドするしかないようです。
Ghostscript のビルドは
使用バージョン: Ghostscript 9.16
$ ./configure --disable-compile-inits $ make $ sudo make installというやり方をよく見かけます。–disable-compile-inits は今後のために付けておいたほうが良いらしいです。 この configure にオプションをひとつ追加することで、今回の問題を解決することにします。 結果だけ示せば、
$ ./configure --disable-compile-inits --with-drivers=ALL,tiffscaled4,tiffscaled8,tiffscaled24,tiffscaled32 $ make $ sudo make installとすれば解決します。 –with-drivers には、gs のオプションの -sDEVICE に指定する文字列(機能)を指定します。 ./configure の –help では以下のように説明されてます。
$ ./configure --help
(略)
--with-drivers=LIST Drivers to support, separated by commas.
Either list the drivers or use aliases:
ALL = all drivers
FILES = all file format drivers
PRINTERS = all printer drivers
Printers:
APPLE = all Apple printers
BROTHER = all Brother printers
CANON = all Canon printers
EPSON = all Epson printers
HP = all HP printers
IBM = all IBM printers
JAPAN = older japanese printers
LEXMARK = all Lexmark printers
OKI = all OKI printers
PCLXL = all PCL XL/6 printers
File formats:
BMP = Output to bmp files
FAX = Output to fax files
JPEG = Output to JPEG files
PBM = Output to PBM/PNM
PCX = Output to PCX
PNG = Output to PNG
PS = Output to PostScript/PDF
TIFF = Output to TIFF
You can mix both variants, e.g.
--with-drivers=HP,stcolor would build HP drivers and
the Epson stcolor driver.
Aliases must be uppercase (a 3rd party driver might
have the same name).
Default: ALL
(略)
たとえば jpeg 出力限定の Ghostscript を作成する場合は、
$ ./configure --disable-compile-inits --with-drivers=jpeg,jpegcmyk,jpeggrayと指定しますが、
$ ./configure --disable-compile-inits --with-drivers=JPEGという指定もできます。この JPEG は jpeg jpegcmyk jpeggray のエイリアス(別名)となっています。 さらに FILES は BMP FAX JPEG PBM PCX PNG PS TIFF のエイリアス、 PRINTERS は APPLE BROTHER CANON EPSON HP IBM JAPAN LEXMARK OKI PCLXL のエイリアス、 そして ALL は FILES PRINTERS のエイリアス、ということを示しています。 通常は ALL で問題ないので –with-drivers の指定すら省略するのですが、 今回は ALL にさらに項目を追加する必要があるので –with-drivers の出番となったワケです。 できあがった Ghostscript を確認してみると、ちゃんと tiffscaled4 〜 tiffscaled32 が使えるようになっているのが確認できます。
$ gs --help GPL Ghostscript 9.16 (2015-03-30) Copyright (C) 2015 Artifex Software, Inc. All rights reserved. Usage: gs [switches] [file1.ps file2.ps ...] Most frequently used switches: (you can use # in place of =) -dNOPAUSE no pause after page | -q `quiet', fewer messages -gところで configure の最中に、x page size in pixels | -r pixels/inch resolution -sDEVICE= select device | -dBATCH exit after last file -sOutputFile= select output file: - for stdout, |command for pipe, embed %d or %ld for page # Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF Default output device: x11alpha Available devices: (略) stcolor sunhmono t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc tiff32nc tiff48nc tiff64nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray tifflzw tiffpack tiffscaled tiffscaled24 tiffscaled32 tiffscaled4 tiffscaled8 tiffsep tiffsep1 txtwrite uniprint x11 x11alpha x11cmyk (略)
Support for external codecs: ZLIB support: no Pixar log-format algorithm: no JPEG support: no Old JPEG support: no JPEG 8/12 bit dual mode: no ISO JBIG support: no LZMA2 support: noと、ZLIB support から Old JPEG support の4項目が no 表示される場合があります。 エラーではないのですがこのまま make を実行すると、(多分)画像を含むほとんどの PDF/EPS が取り扱えない Ghostscript ができあがってしまうので、ぜひ解決しておきましょう。 これらは libjpeg-turbo-devel と zlib-devel の2つのパッケージをインストールしておけばオッケーです。CentOS では、
$ sudo yum install libjpeg-turbo-devel zlib-develとなります。再 configure して、次のように表示されれていれば大丈夫です。
Support for external codecs: ZLIB support: yes Pixar log-format algorithm: yes JPEG support: yes Old JPEG support: yes JPEG 8/12 bit dual mode: no ISO JBIG support: no LZMA2 support: no
使用バージョン: Ghostscript 9.16