Skip to content

Instantly share code, notes, and snippets.

Examine the format of * .ani file, look in the file. After the `BitmapInfoHeader` header, there is a block with the image data of each frame. The header shows that the number of bits per pixel is `BitCount = 32`. To store the image of each frame, a mask with cursor pixels (XOR mask) and a one-bit transparency mask (AND mask) are used.
```
XOR mask: (IconDirEntry.Width * IconDirEntry.Height * BitCount) / 8 = 32 * 32 * 32/8 = 4096 bytes
AND mask: (IconDirEntry.Width * IconDirEntry.Height) / 8 = 32 * 32/8 = 128 bytes
```
For 32-bit images, an AND mask is not required, but recommended. It is necessary to pay attention to this mask. Get 1024 bits from this mask from each frame, and convert to 32x32 pixels image (where "1" is white, and "0" is a black pixel). Notice that there is a symbol in this image. Compose a flag.