I have a binary file which contains several images in various uncompressed formats (24-bit per pixel RGB, 8-bit indexed pixels, etc.). Interspersed in this file are also strings and other data. I'd like to extract the images from the file and also determine their parameters (bit-depth, horizontal dimension, vertical dimension).

Is there a program that can intelligently do this? Here's an example:

Suppose this image is in the binary file:

Correct dimensions

To extract that image (in the absence of any header info), I need to know the bit-depth, the size, and at least one dimension. That image is 300x300 pixels. If I extract the data and guess the dimensions wrong (say, 250x360), I would end up with this image:

Incorrect dimensions

Is there a program that can make multiple guesses of these three variables and end up with the correct answer by looking at the resulting image? I'm guessing such a program would make use of TensorFlow or something similar.

  • Wow, that second one looks nice. What makes you think that 250x360 is the wrong size? I would say that 300x300 is the wrong size instead. - Sorry, I doubt there will ever be such a thing. Everything could be a picture, even random numbers could be a picture of noise. – Thomas Weller Aug 30 '18 at 20:16
  • @Thomas - true. The algorithm could get fooled. However, the slanting lines are an indication, when I'm trying the guess the image size, that I've gotten it wrong. Nevertheless, your comment made my day. :) – watkipet Aug 30 '18 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.