2

I have a binary blob, and I know that it carries bitmap image data, 1-bit depth.

However, I don't know how the bitstream can be decoded; judging from the screenshot from here, which is of a program called LCD Assistant:

LCD Assistant

I'd need to be able to specify byte orientation, WxH size, endianness, pixels/byte, in order to fully decode unknown byte format. (And the above tool is not appropriate, because it is a "tool for converting monochromatic bitmaps to data arrays" in C)

I tried Gimp File/Open Image (click Select File Type (Automatically Detected), a list opens, choose "Raw image data" with extension (data), click Open), and I get this screen ("Load Image from Raw Data"):

enter image description here

So, I can choose B&W 1 bit, offset, width, height - but no byte orientation, endianness, or pixels/byte.

Is there a command line tool that can decode a binary blob as a 1-bit bitmap, and convert that to a "normal" PNG (say, a grayscale PNG)?

I guess ImageMagick convert could probably do it - but I simply cannot find any example on how to do this, and I cannot find which of its many, many options might be appropriate, if any.

3
  • 1
    Does this works? convert -depth 1 -size <width>x<height> gray:<input_file> <output_file>.png Commented May 2, 2023 at 0:51
  • Thanks @GillesQuénot - unfortunately it does not; I sort of guess gray: would force 8-bit intepretation of the input file, and I know it is in 1-bit - but in say 0b10101011, the bits could represent pixel values row-wise, or column-wise; and without being able to specify this in the command line, it will be difficult to decode
    – sdbbs
    Commented May 2, 2023 at 1:02
  • 2
    Try sharing your blob - maybe using Google Drive or Dropbox. Commented Aug 6, 2023 at 15:14

1 Answer 1

2

... tool that can decode a binary blob as a 1-bit bitmap, and convert that to a "normal" .png

Many programs can visualize raw binary data of varying bit formats (bitplanar, channel planar, linear, YCbCr, 1/2/3/4/8/16/32 bits, block compressed...) as images, which you can then copy and save to whatever image format you want, but I've never seen one that supports 1bpp, bit direction (LSB to MSB vs MSB to LSB), and also orientation (LTR vs TTB). However, some that get you closer to your goal include:

... a command line tool ...

What's the motivation for it being command line? Unless you're automating a repeated process (like an app build or batch processing a whole folder full of them), GUI's are much easier to interactively tweak properties and immediately see the result until you get the desired visual output.

Like Mark Setchell suggested, if you share your sample data, somebody is likely to try to figure it just for the fun of solving a puzzle, and there are even communities that focus on that.

enter image description here

enter image description here

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .