Re: [Image-SIG] Determine byte offset of JPEG SOI marker

2009-02-01 Thread Ned Batchelder
In the files I'm looking at, the SOI marker (ffd8) is at offset 0. But assuming you have some where it is not, why not just open the file, and look for the marker?: head = open(jpg_filename, "rb").read(4000) soi_offset = head.find('\xff\xd8') You're going to have to open and read the fi

Re: [Image-SIG] Determine byte offset of JPEG SOI marker

2009-02-01 Thread Franz Buchinger
I think I made a conceptual mistake: I should look for SOS (ffda, start of stream), not SOI (start of image). Unfortunately, figuring out this marker is not so easy, because many JPEG files from digital still cameras have a thumbnail embedded in one of their header segments. As this thumbnail imag

[Image-SIG] Determine byte offset of JPEG SOI marker

2009-02-01 Thread Franz Buchinger
Hi, I want to implement some sort of "post header checksum" for JPEG images, i.e. the checksum should only change if the actual image data was altered, EXIF/IPTC metadata modifications should have no effect. My plan to do this is to scan for the JPEG SOI marker, read n bytes after this marker and

[Image-SIG] Determine byte offset of JPEG SOI marker

2009-01-29 Thread Franz Buchinger
Hi, I want to implement some sort of "post header checksum" for JPEG images, i.e. the checksum should only change if the actual image data was altered, EXIF/IPTC metadata modifications should have no effect. My plan to do this is to scan for the JPEG SOI marker, read n bytes after this marker and