[Image-SIG] Determine byte offset of JPEG SOI marker
Ned Batchelder
ned at nedbatchelder.com
Sun Feb 1 17:35:18 CET 2009
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 at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>
>
>
>
--
Ned Batchelder, http://nedbatchelder.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090201/25fafe44/attachment.htm>
More information about the Image-SIG
mailing list