It seems expensive to read all the segments. Doesn't the JPEG standard guarantee that the APP segments will come before the image data segments? Can't you just read until you find the EXIF data and then stop?