October 31, 2003

NetPBM

ImageMagick(PerlMagick)に敗北したままなのですが、なんとか画像のサムネイルを使いたいと思っていたところ、ImageMagickのかわりにNetPBMというツールが使用できるようなので、それで試してみることにしました。

で、結果は成功しましたが、NetPBMの共有ライブラリのパスにちょっと細工が必要でした。原因はMacOSXのリンカが*NIXの体系と微妙に異なっているためだと思われます。とりあえず、インストール手順を。

インストール手順
(1)PerlにIPC::Runモジュールを導入(本家のマニュアルにも書いていないらしいので、結構重要)

$ perl -MCPAN -eshell
> install IPC::Run

(2)NetPBMをバイナリよりビルド
$ cd /usr/local/src
$ wget http://heanet.dl.sourceforge.net/sourceforge/netpbm/netpbm-10.18.1.tgz
$ tar zvxf netpbm-10.18.1.tgz
$ cd netpbm-10.18.1
$ ./configure
$ make
$ make package

./configureのところでいろいろ聞かれますが、Defaultのまま=エンターキー連打でいいと思います。最後にインストール。
bash-2.05a$ sudo ./installnetpbm
Welcome to the Netpbm install dialogue. We will now proceed
to interactively install Netpbm on this system.

You must have already built Netpbm and then packaged it for
installation by running 'make package'. See the INSTALL file.

Where is the install package you created with 'make package'?
package directory (/tmp/netpbm) ==>

Enter the default prefix for installation locations. I will use
this in generating defaults for the following prompts to save you
typing. If you plan to spread Netpbm across your system,
enter '/'.

install prefix (/usr/local/netpbm) ==>

No directory named '/usr/local/netpbm' exists. Do you want to create it?
Y(es) or N(o) (Y) ==>
Where do you want the programs installed?

program directory (/usr/local/netpbm/bin) ==>

Installing programs...
cp: chown: /usr/local/netpbm/bin/ppmtouil: No such file or directory
cp: chmod: /usr/local/netpbm/bin/ppmtouil: No such file or directory
cp: utimes: /usr/local/netpbm/bin/ppmtouil: No such file or directory
cp: chown: /usr/local/netpbm/bin/ppmtojpeg: No such file or directory
cp: chmod: /usr/local/netpbm/bin/ppmtojpeg: No such file or directory
cp: utimes: /usr/local/netpbm/bin/ppmtojpeg: No such file or directory
cp: chown: /usr/local/netpbm/bin/ppmnorm: No such file or directory
cp: chmod: /usr/local/netpbm/bin/ppmnorm: No such file or directory
cp: utimes: /usr/local/netpbm/bin/ppmnorm: No such file or directory
cp: chown: /usr/local/netpbm/bin/pnminterp: No such file or directory
cp: chmod: /usr/local/netpbm/bin/pnminterp: No such file or directory
cp: utimes: /usr/local/netpbm/bin/pnminterp: No such file or directory
cp: chown: /usr/local/netpbm/bin/pnmfile: No such file or directory
cp: chmod: /usr/local/netpbm/bin/pnmfile: No such file or directory
cp: utimes: /usr/local/netpbm/bin/pnmfile: No such file or directory
cp: chown: /usr/local/netpbm/bin/pnmarith: No such file or directory
cp: chmod: /usr/local/netpbm/bin/pnmarith: No such file or directory
cp: utimes: /usr/local/netpbm/bin/pnmarith: No such file or directory
cp: chown: /usr/local/netpbm/bin/pgmslice: No such file or directory
cp: chmod: /usr/local/netpbm/bin/pgmslice: No such file or directory
cp: utimes: /usr/local/netpbm/bin/pgmslice: No such file or directory
cp: chown: /usr/local/netpbm/bin/pgmoil: No such file or directory
cp: chmod: /usr/local/netpbm/bin/pgmoil: No such file or directory
cp: utimes: /usr/local/netpbm/bin/pgmoil: No such file or directory
cp: chown: /usr/local/netpbm/bin/pgmedge: No such file or directory
cp: chmod: /usr/local/netpbm/bin/pgmedge: No such file or directory
cp: utimes: /usr/local/netpbm/bin/pgmedge: No such file or directory
cp: chown: /usr/local/netpbm/bin/bmptoppm: No such file or directory
cp: chmod: /usr/local/netpbm/bin/bmptoppm: No such file or directory
cp: utimes: /usr/local/netpbm/bin/bmptoppm: No such file or directory
Copy of programs from /tmp/netpbm/bin to /usr/local/netpbm/bin failed.
cp return code is 256

Where do you want the shared library installed?

shared library directory (/usr/local/netpbm/lib) ==> /usr/local/lib

Installing shared libraries...
cp: chown: /usr/local/lib/libnetpbm.10.dylib: No such file or directory
cp: chmod: /usr/local/lib/libnetpbm.10.dylib: No such file or directory
cp: utimes: /usr/local/lib/libnetpbm.10.dylib: No such file or directory
Copy of libraries from /tmp/netpbm/lib to /usr/local/lib failed.
cp return code is 256


Where do you want the static link library installed?

static library directory (/usr/local/netpbm/lib) ==>

Installing link libraries.
cp: chown: /usr/local/netpbm/lib/libnetpbm.dylib: No such file or directory
cp: chmod: /usr/local/netpbm/lib/libnetpbm.dylib: No such file or directory
cp: utimes: /usr/local/netpbm/lib/libnetpbm.dylib: No such file or directory
Copy of files from /tmp/netpbm/link to /usr/local/netpbm/lib failed.
cp return code is 256

Where do you want the data files installed?

data file directory (/usr/local/netpbm/lib) ==>

Installing data files...
done.

Where do you want the library interface header files installed?

header directory (/usr/local/netpbm/include) ==>

Installing interface header files...
done.

Where do you want the man pages installed?

man page directory (/usr/local/netpbm/man) ==>

Installing man pages...
done.

Your manweb.conf file says top level documentation is in /usr/man/web,
but you installed netpbm.url in /usr/local/netpbm/man/web.
Do you want to create a symlink in /usr/man/web now?
create symlink (Y/N) (Y) ==>
Failed to create symbolic link from /usr/man/web/netpbm.url to /usr/local/netpb
/man/web/netpbm.url. Error is File exists

Installation is complete (except where previous error messages have
indicated otherwise).


いっぱいエラーでていますが、大丈夫(だと思う)。ポイントはshared libraryのパスを/usr/local/libに変更したこと。こうしないと、実行したときにライブラリのパスが通っていませんというエラーがでて先に進まない(このエラーは環境変数$DYLD_LIBRARY_PATH=/usr/local/netpbm/libにすることによって回避可能でしたが、使用するたびに環境変数をいちいち設定するのは気持ち悪いので…)が、このように設定することで回避可能になりました。

(3)最後にmt.cfgの設定。
以下の2個所を探して修正してください。

# Specifies the image toolkit used to create thumbnails from uploaded images.
# By default, the ImageMagick library and Image::Magick Perl module are used;
# if your system does not have these, you can use the NetPBM tools instead
# (assuming that your system has these tools installed). Possible values for
# this setting are "ImageMagick" or "NetPBM".
#
# ImageDriver NetPBM
#
#
# By default, Movable Type looks for the NetPBM tools in three locations:
# /usr/local/netpbm/bin, /usr/local/bin, and /usr/bin. If your
# NetPBM tools are installed in a different location, you can adjust the
# NetPBMPath configuration setting. Note that this path should be the path
# to the directory containing the NetPBM binaries; for example, if your
# pnmscale binary is at /home/foo/netpbm/bin/pnmscale, you should
# set the value of NetPBMPath to /home/foo/netpbm/bin.
#
# NetPBMPath /home/foo/netpbm/bin

これを
# Specifies the image toolkit used to create thumbnails from uploaded images.
# By default, the ImageMagick library and Image::Magick Perl module are used;
# if your system does not have these, you can use the NetPBM tools instead
# (assuming that your system has these tools installed). Possible values for
# this setting are "ImageMagick" or "NetPBM".
#
ImageDriver NetPBM
#
#
# By default, Movable Type looks for the NetPBM tools in three locations:
# /usr/local/netpbm/bin, /usr/local/bin, and /usr/bin. If your
# NetPBM tools are installed in a different location, you can adjust the
# NetPBMPath configuration setting. Note that this path should be the path
# to the directory containing the NetPBM binaries; for example, if your
# pnmscale binary is at /home/foo/netpbm/bin/pnmscale, you should
# set the value of NetPBMPath to /home/foo/netpbm/bin.
#
NetPBMPath /usr/local/netpbm/bin

に書き換えてください。これで完了、イメージのUp時にサムネイルがつくれるようになりました。

22:09 fenrir が投稿 : 固定リンク | | このエントリーを含むはてなブックマーク | トラックバック
このエントリーのトラックバックURL: https://fenrir.naruoka.org/mt/mt-tb.cgi/65
コメント
コメントする









名前、アドレスを登録しますか?
(次回以降コメント入力が楽になります)
  • 匿名でのコメントは受け付けておりません。
  • 名前(ハンドル名可)とメールアドレスは必ず入力してください。
  • メールアドレスを表示されたくないときはURLも必ず記入してください。
  • コメント欄でHTMLタグは使用できません。
  • コメント本文に日本語(全角文字)がある程度多く含まれている必要があります。
  • コメント欄内のURLと思われる文字列は自動的にリンクに変換されます。