Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimise bitmap mini/bmp.bmp #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ace-dent
Copy link

Smashed the 334 bytes original down to a slim 60 bytes, by hand crafting a v1.x BMP file.

All versions of the BMP format begin with a basic 14 byte file header.
Next is the secondary DIB header; 12 bytes is the smallest possible (IBM OS/2 – v1.x BMP files).

Avoiding the more ‘advanced’ / modern bitmap file formats has a big impact for small files, while still widely supported and well documented.

Sources:
http://www.fileformat.info/format/os2bmp/egff.htm
http://www.fileformat.info/format/bmp/egff.htm
http://en.wikipedia.org/wiki/BMP_file_format
https://msdn.microsoft.com/en-us/library/dd183372(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/dd183374(v=vs.85).aspx

Smashed the 334 bytes original down to a slim 60 bytes, by hand crafting a v1.x BMP file.

All versions of the BMP format begin with a basic 14 byte file header.
Next is the secondary DIB header; 12 bytes is the smallest possible (IBM OS/2 – v1.x BMP files).

Avoiding the more ‘advanced’ / modern bitmap file formats has a big impact for small files, while still widely supported and well documented.

Sources:
http://www.fileformat.info/format/os2bmp/egff.htm
http://www.fileformat.info/format/bmp/egff.htm
http://en.wikipedia.org/wiki/BMP_file_format
https://msdn.microsoft.com/en-us/library/dd183372(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/dd183374(v=vs.85).aspx
@ace-dent
Copy link
Author

The committed version is ‘clean’, zero bit padded -totally vanilla.
data:image/bmp;base64,Qk08AAAAAAAAACAAAAAMAAAADQAHAAEAAQD///8AAAAAAAAAZUAAAFVAAABnYAAAV1AAAGVgAAAAAAAA

But since each row has to be padded to a 4 byte boundary, we actually have 19 bits of padding (32 bits - 13 bits).
We might replace the last 2 bytes per row with a hidden image!
data:image/bmp;base64,Qk08AAAAAAAAACAAAAAMAAAADQAHAAEAAQD///8AAAAAAAAAZUCm7FVAqIpnYOjKV1CoimVgRuwAAAAA

Changing ‘bcWidth’ at address 18 from 0x0D (decimal 13) to 0x20 (decimal 32), reveals our steganography…
data:image/bmp;base64,Qk08AAAAAAAAACAAAAAMAAAAIAAHAAEAAQD///8AAAAAAAAAZUCm7FVAqIpnYOjKV1CoimVgRuwAAAAA

Or, we might choose to hide some other data in those bytes :-)
data:image/bmp;base64,Qk08AAAAAAAAACAAAAAMAAAADQAHAAEAAQD///8AAAAAAENPZUBSS1VAQU1nYEkuV1BBTWVgUksAAENP

@ace-dent
Copy link
Author

Bump @angea :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant