pgmtopbm

機能

graymap(pgm)をbitmap(pbm)に変換する

起動方法

     pgmtopbm [-floyd|-fs|-threshold|-dither8|-d8 |
              -cluster3|-c3|-cluster4|-c4|-cluster8|-c8]
              [-value  val]
              [pgmfile]

説明

graymapを入力ファイルとして読み込んで、bitmapを出力する。
このコマンドを使う前にppmconvolなどでフィルタリングをかけてから pgmtopbmをかけると結果が良くなることもある。
なおppmをgraymap(pgm)やppmに変換するコマンドは存在しない。
なぜならたいていのppmやpgmを読むコマンドはpbmも読み込むことが できるからである。

パラメータの説明

graymapをbitmapに変換する方法は次の通り。

-floyd | -f
boustrophedonic Floyd-Steinberg error diffusion (デフォールト)
これが普通は一番良い方法である。
しかしいつも良いとは限らない。
-threshold シンプルな、閾値による方法
-dither8 | -d8
Bayer's ordered dither with a 16x16 matrix
-cluster3 | -c3
45-degree clustered-dot dither
-cluster4 | -c4
45-degree clustered-dot dither
-cluster8 | -c8
45-degree clustered-dot dither
新聞の写真のような効果が出る。
-value val
-floydまたは-thresholdのときの閾値を決める。
閾値valは実数で0から1までの値である。

test.pgmをとして以下のコマンドを実行してみると、

pgmtopbm org.pgm > test1.pbm
test1.pbm

pgmtopbm -threshold -val 0.5 org.pgm > test2.pbm
test2.pbm

pgmtopbm -dither8 org.pgm > test3.pbm
test3.pbm

pgmtopbm -cluster3 org.pgm > test4.pbm
test4.pbm

pgmtopbm -cluster4 org.pgm > test5.pbm
test5.pbm

pgmtopbm -cluster8 org.pgm > test6.pbm
test6.pbm

参考文献

The only reference you need for this stuff is "Digital Half- toning" by Robert Ulichney, MIT Press, ISBN 0-262-21009-6.

参照

プログラマー/バージョン

     Copyright (C) 1989 by Jef Poskanzer.

     Permission  to  use,  copy,  modify,  and  distribute   this
     software  and  its documentation for any purpose and without
     fee is hereby granted, provided  that  the  above  copyright
     notice  appear  in  all  copies and that both that copyright
     notice and this permission notice appear in supporting docu-
     mentation.   This  software  is  provided  "as  is"  without
     express or implied warranty.

Home | Contents
abe@injapan.net