1) Thank you very much for helping me! =D
2) How can I make a 13 byte binary file? And how can I read it as an image later?
3) So I found out I was able to change the format to .pbm (which in theory only has 1 bit per pixel, and 2 header bytes) and the file did in fact shrink, but to 29 bytes. Which is still 2x what I would hope. Is there a way to shave off those extra bits?
4) I used command line xxd -b to look at the binary code of the image, and since my first row only has 10 black pixels, I was able to find where the first row of the image was (a sequence of 10 ones). This is how the file looks in binary (i've darkened the row I think is the first of the image):
01010000 00110100 00001010 00110001 00110000 00100000
00110001 00110000 00001010 11111111 11000000 11110000
11000000 11111011 01000000 11111011 01000000 11111100
11000000 11111110 01000000 11110000 01000000 11111110
11000000 11111110 11000000 11111100 11000000
I realize the first two bytes mean P4, which is the type of .pbm file. But what about the rest?
*Edit: Ok, I actually think I got this one, the first 2 bytes are P4, then there's a '0a' symbol (00001010 in binary) - seems to mean 'line feed' - then 2 bytes for the height, then one byte for space, then another 2 bytes for the width, then that '0a' again.
But there's still the question of why are there still 160 bits for the image, instead of only 100 bits after the headers..
Once again, thank you very much!
Edited by raphaelta, 30 September 2016 - 05:09 AM.