Interesting topic with all the code snippets.
In Hex view all I do is look for the 4 bytes that come after 00 11 08 and that will always be your dimensions.
Let's take a basic image say 82 x 82 pixels. The 4 bytes following 00 11 08 will be 00 52 00 52.
In UTF-8 this will appear visually as NUL DC1 BS NUL R NUL R
The NUL before the R indicates that the image falls below the 256 pixel range.
The R indicates the 82nd character in the ASCII table, hence 82x82.
Let's say the 4 dimension bytes were SOH R SOH R , then the image would be 338x338
Why: Becuase 338 minus 256 = 82
Hope this simple explanation helps understand it a bit better.
Example of 82x82: https://vanta.host/uploads/1747762013988-477888795.jpg