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 file to compute the checksum anyway...

--Ned.
http://nedbatchelder.com

Franz Buchinger wrote:
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 calcultate an MD5/SHA checksum for this.

Can PIL tell me the byte offset of this marker?

Greetings,

Franz
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig




--
Ned Batchelder, http://nedbatchelder.com

_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to