Binary image creation

you could use PNG fileformat for doing such a task!
if you want to store 8 pixels in a byte in memory you could use array of bool because bool could only store 0 or 1, true or false, you could say true = white, false = black.
for example:

int main()
{
	std::vector<bool> binImage = { 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, .... };
}