^GFa,b,c,d,data command, how calculate the parameters?



I have .PNG file, which has 800x800 px size (it is monochrome). I want to print it.

I use:

string ConvertToHex(string inputFilePath){     var bytes = File.ReadAllBytes(inputFilePath);     var hexString = string.Join("", bytes.Select(x => x.ToString("X2")));     return hexString;}//...string hexBytes = ConvertToHex(@"TEST.png");int length = binaryData.Length;int length = binaryData.Length;int inRow = length / 16;string str = "^XA^FO0,0^GFA," + length + "," + length + "," + inRow + "," + hexBytes + "^XZ";
but when I send it, it doesn't print corectly, it prints one cm of different pixels.

How to calculate length of image and inRow bytes?

Thanks Mike