I've got raw data streams from image files, like:
vector<char> rawData(fileSize);
ifstream inFile("image.jpg");
inFile.read(&rawData[0]);
I want to parse the headers of different image formats for height and width. Is there a portable library that can can read ints, longs, shorts, etc. from the buffer/stream, converting for endianess as specified?
I'd like to be able to do something like: short x = rawData.readLeShort(offset);
or long y = rawData.readBeLong(offset)
An even better option would be a lightweight & portable image metadata library (without the extra weight of an image manipulation library) that can work on raw image data. I've found that Exif libraries out there don't support png
and gif
.