如何使用ImageMagick生成灰度PAM文件?
使用 imagemagick 生成 P5 PGM / P6 PPM 是微不足道的,简单地使用
$ convert -depth 12 -size 512x512 xc:white white12.pgm
$ convert -depth 12 -size 512x512 xc:white white12.ppm
哪个正确给出:
% head -3 white12.ppm white12.pgm
==> white12.ppm <==
P6
512 512
4095
==> white12.pgm <==
P5
512 512
4095
现在我正在努力获取 PAM:P7 + 灰度工作,我能找到的是:
$ convert -depth 12 -size 512x512 xc:white white12.pam
它给出了 RGB
一个:
% head -7 white12.pam
P7
WIDTH 512
HEIGHT 512
DEPTH 3
MAXVAL 4095
TUPLTYPE RGB
ENDHDR
如何生成GRAYSCALE
帕姆一?
我确实向上游报告了一个错误,也许我的 imagemagick 版本中有一些虚假内容:
It is trivial to generate P5 PGM / P6 PPM using imagemagick, using simply
$ convert -depth 12 -size 512x512 xc:white white12.pgm
$ convert -depth 12 -size 512x512 xc:white white12.ppm
Which correctly gives:
% head -3 white12.ppm white12.pgm
==> white12.ppm <==
P6
512 512
4095
==> white12.pgm <==
P5
512 512
4095
Now I am struggling to get PAM: P7 + Grayscale working, all I could find is:
$ convert -depth 12 -size 512x512 xc:white white12.pam
which gives the RGB
one:
% head -7 white12.pam
P7
WIDTH 512
HEIGHT 512
DEPTH 3
MAXVAL 4095
TUPLTYPE RGB
ENDHDR
How can I generate the GRAYSCALE
PAM one ?
I did report a bug upstream, maybe there is something bogus in my imagemagick version:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为 ImageMagick 中有一个错误。这可能是一个解决方法:
产生这一点:
I think there is a bug here in ImageMagick. This might be a workaround:
That produces this:
在ImageMagick中,要创建文本格式NetPBM文件,请添加-compress无。
In Imagemagick, to create text format NetPBM files, add -compress none.