convert from random input file to 1 bit bitmap
Posted: 2014-12-16T17:05:52-07:00
I want to be able to visualize the bit distribution in a file containing random bytes, like this
.
At the moment, I do it by converting the data file to ascii, and then to PBM (P1), and then convert it to a bitmap using ppmtobmp.
This is not a pretty way of doing it, but it works :/
How do I do this with convert? I do not know where to begin, since the input file is not an image but just a bunch of random bytes.
I tried "fooling" convert it was a an RGB file, eg: convert -depth 1 -monochrome -size 1920x1080.rgba output.bmp
This will give me a monochrome picture, but it is converted wrong, compared to the ppmtobmp way. It looks like it does not actually use 1 bit per pixel
Any starting pointers on how to do this?
At the moment, I do it by converting the data file to ascii, and then to PBM (P1), and then convert it to a bitmap using ppmtobmp.
This is not a pretty way of doing it, but it works :/
How do I do this with convert? I do not know where to begin, since the input file is not an image but just a bunch of random bytes.
I tried "fooling" convert it was a an RGB file, eg: convert -depth 1 -monochrome -size 1920x1080.rgba output.bmp
This will give me a monochrome picture, but it is converted wrong, compared to the ppmtobmp way. It looks like it does not actually use 1 bit per pixel

Any starting pointers on how to do this?