在OS X上生成用于测试/调试的一次性映像

时间:2015-11-24 15:47:23

标签: macos raster

编写处理图像的代码时,Linux上很容易使用ppmmakebggenpnmpaste生成样本光栅图像。

OS X上是否有类似的实用工具,使用MacPorts,brew,ImageMagick,SVG或其组合?

一个解决方案(编写写出ppm文件的简短代码,然后使用ImageMagick的转换转换为png)很简单,但却很乏味。

1 个答案:

答案 0 :(得分:0)

以下是一些ImageMagick示例:

# Checkerboard
convert -size 200x200 pattern:checkerboard checker.png

enter image description here

# Pure b/w checkerboard
convert -size 200x200 pattern:checkerboard -threshold 50% checker.png

enter image description here

# Plain gradient
convert -size 200x200 gradient:red-black grad.png

enter image description here

# Partially transparent gradient
convert -size 200x200 gradient:"rgba(255,255,0,0.3)-rgba(0,128,0,0.6)" grad.png

enter image description here

# French flag!
convert -size 50x100 xc:blue xc:white xc:red +append france.png

enter image description here

# French flag hanging on horizontal pole to stdout
convert -size 150x100 xc:blue xc:white xc:red -append -compress none png:

P3
150 300
4294967295
0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535 0 0 65535

enter image description here