A BMP image (DIB) consists of a header followed by uncompressed data of color 1 (for 24 images in bpp format, these are 3 bytes per pixel, stored in line order and in 4-byte increments).
Bytes for color data are used to represent colors (that is, none of them are “fixed” in file format 2 , they all come from the color of each pixel), and there is a perfect 1: 1 correspondence between pixel colors and bytes recorded in the file ; Thus, using perfectly selected colors, you can actually write whatever you want in the file (except for the header).
When you open the generated file in notepad, the color data will be displayed as text; you can still clearly see from the header (the part from BM to the beginning of the text), which is determined by the file format.
In my opinion, this video was made as follows: first, the author calculated the size needed for the raster image, and created a DIB file with the correct size, filled with color, which expands to a simple template (for example, all bytes 65 => 'A' ); then replaced the template with a “payload” code, as shown in the video.
Please note that this cannot be done manually using notepad - with a color selection dialog, ASCII table and basic knowledge of the DIB format, this can be done, but it will be much slower, and the error is -prone.
More on DIB format
- There are compressed DLEs with RLE, but in this case, uncompressed bitmaps are used (and they are used very rarely anyway).
- With the exception of the step, this was avoided using strings of 4 bytes.
Matteo Italia Apr 07 '11 at 23:16 2011-04-07 23:16
source share