The short answer to this question is that in order to find the “real” ImageLength, you have to decode the image and see what happens.
In theory, you can multiply the RowsPerStrip tag and multiply this by the number of lines that will have a length that the image cannot exceed, but if the last line is less than the line on the line, you need to decode the last line to know exactly. For tiles, you can do something similar.
This, of course, applies only if the image is stripped or laid out.
Otherwise, to find out you have to decode.
source
share