1j01 / jspaint

🎨 Classic MS Paint, REVIVED + ✨Extras
https://jspaint.app/about
MIT License
7.16k stars 562 forks source link

.bmp file saves incorrectly #339

Open Ducklord42 opened 2 months ago

Ducklord42 commented 2 months ago

When I save a .bmp file (24-bit color depth) the format is all messed up. The height bytes where "f8 ff ff ff" instead of "08 00 00 00" and the image was 8 by 8 pixels. Also the image was upside down when I reopened it and by own photo viewer program. It might be that the program doesn't take into account that bitmap files store the data upside down; from left to right then bottom to top. Here is the hex file (I fixed the height coordinates but not the photo being upside down):

0000000 4d42 00f6 0000 0000 0000 0036 0000 0028 0000010 0000 0008 0000 0008 0000 0001 0018 0000 0000020 0000 00c0 0000 0000 0000 0000 0000 0000 0000030 0000 0000 0000 ffff ffff ffff ffff ffff 0000040 ffff ffff ffff ffff ffff ffff ffff ffff 0000050 00ff 0000 0000 0000 0000 0000 0000 0000 0000060 0000 ff00 ffff ffff ffff ffff ffff ffff 0000070 ffff 0000 ff00 ffff ffff ffff ffff ffff 0000080 ffff ffff ffff ffff ffff 0000 2400 ed1c 0000090 1c24 ffed ffff ffff ffff ffff 0000 ff00 00000a0 ffff 0000 2400 ed1c 1c24 ffed ffff ffff 00000b0 ffff ffff ffff ffff ffff 0000 2400 ed1c 00000c0 1c24 ffed ffff ffff 00ff 0000 0000 0000 00000d0 0000 0000 2400 ed1c 1c24 ffed ffff ffff 00000e0 ffff ffff ffff ffff ffff ffff ffff ffff 00000f0 ffff ffff ffff