我正在尝试运行具有以下要求的程序:
This program reads in an uncompressed gray-scale image with one byte per pixel and a size of 256*256 pixels (no image header)
如何转换 jpg
图像以满足上述要求。
最佳答案
在命令行中使用 ImageMagick:
magick input.jpg -resize 256x256\! -depth 8 -colorspace gray GRAY:image.raw
ImageMagick 包含在大多数 Linux 发行版中,并且适用于 macOS 和 Windows。在版本 6 及更早版本中,将上述命令中的 magick
更改为 convert
。
关于将图像转换为原始位图文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55166611/