This is a test project where image generation is done in C++ using portable grey maps (PGM) File Formats as it's the easiest file format to be written using a low level language like C++
PGM FIle format consists of a header of usually 3 lines
First line is a string identifies the file format (P3)
Second line is the size of the image
Third line is the maximum value of the color range
Example of a PGM image:
P3
#This is example of letter P
6 10
1
0 1 1 1 0 0
0 1 0 0 1 0
0 1 0 0 1 0
0 1 0 0 1 0
0 1 0 0 1 0
0 1 1 1 0 0
0 1 0 0 0 0
0 1 0 0 0 0
0 1 0 0 0 0
0 1 0 0 0 0
Read more about Netpbm formats here https://en.wikipedia.org/wiki/Netpbm_format
You can set the size of the image by setting the width and height int variables
You can create rectangles by defining the X,Y Positions and the Size of the rectangle (SizeX & SizeY)
example :
rect(0,0,50,50);
This will create a square of side length 50 pixels from the top left corner of the image