I'm confused about that first number that is written to the output file.
The first line in the output file is the "size" of the image. The size is the width or the height of the image, either one. Our images are square.
It is NOT the product of the width and height or the sum of the width and height.