Hi,
I need to find the size of a jpeg (jfif) image. The image is not saved as a stand-alone file, so I can't use GetFileSize or any other API such this one (the image is placed in a stream and no other header is present, except the usual jpeg/jfif header(s).
I did some research and found out that JPEG images are composed of different parts, each part starting with a frame marker (0xFF; XX), and the size of this frame. Using this information I was able to parse a lot of information from the file.
The problem is I cannot find the size of the compressed data, as it seems there is no frame marker for the compressed data. Also, it seems the compressed data follows the SOS (FF;DA) marker and the image ends with the End Of Image (EOI) (FF; D9) marker.
A way to accomplish this would be to search for the EOI marker from byte to byte, but I think the compressed data might contain this combination of bytes, right?
Do you know an easy and correct way to find the total size of the image? (I would strongly prefer some code/idea without any external library please :) ) ?
Basically, I need the distance (in bytes) between the Start of Image(SOI-FFE0) and End of Image (EOI-FFD9).