Как я могу просмотреть файл как изображение MS Paint?

290
mravec

Этот парень пишет код в MS Paint http://www.themarysue.com/writing-code-ms-paint/

Точно так же я хотел бы отображать, просто для удовольствия, различные файлы (текстовые или двоичные) в виде изображения.

Есть ли какая-нибудь полезность?

0

1 ответ на вопрос

1
NuTTyX

I doubt there is any.

That guy knows how BMP format is and calculated equivalences between RGB codes and text, but all the gibberish before the "text" is the BMP headers, which specify things like size, color depth, etc. In former versions, in the headers were included a table with the color encoding of the pixels and the pixels themselves were just pointers to that table.

Since those headers must have some concordance, it is improbable to open an arbitrary file that could be readed as a BMP.

Nevertheless, you could write your own script to read a file and encode it as a BMP file (most of the work would be calculate an optimal size and write the headers before the file itself), but it is pretty useless... For text files you might get some fixed colors al mixed up and for binary files you could find some patterns (since most have sections padded with 0's), but it will be almost as amusing as listening to data tapes.

Похожие вопросы