[pdftex] Embedding Exif-Style JPEG graphics

The Thanh Han hanthethanh at gmx.net
Tue May 14 11:43:22 CEST 2002


> Dear pdftex friends,
> 
> there is some problem of embedding JPEG/Exif images into pdftex, as
> pdftex tells `reading JPEG image failed.' In the
> teTeX-texmfsrc-beta-20020207, file texk/web2c/pdftexdir/writejpg.c there
> is in line 107 a strict check for JFIF=APP0 markers, which blocks
> reading Exif=APP1 files; these don't contain APP0 markers.
> 
> Such JPEG/Exif images are nowadays increasingly often produced by
> digital cameras.
> 
> This can be solved without modifying pdftex, using the nice jhead tool
> from Matthias Wandel:
> 
> http://www.sentex.net/~mwandel/jhead/jhead-1.6.tar.gz
> 
> Calling e. g. jhead -de image.jpg throws out Exif parts from the JPEG
> file and puts a JFIF marker in.
> 
> With Matthias' help (big thanks!) I tried to patch writejpg.c, and now
> apparently pdftex also digests the JPEG/Exif images, at least from the
> CASIO camera here (just as disclaimer :-).
> 
> The patch should not change the original JFIF reading behaviour, but it
> allows some JPEG/Exif file reading, just by less fussy header check
> (with all risks...).
> 
> I don't know whether in the long run one can keep ignoring new
> application headers (only using the JPEG essence), or whether writejpg.c
> would require an extension, might be by using some libjpeg. E. g. the
> img_xres(img) parameter could probably be extracted also from APP1/Exif
> data...
> 
> Standards are available in the Net for Exif (exifStandard.pdf), JPEG
> (itu-t81.pdf, from www.w3.org), and JFIF (jfif3.pdf).

writejpg.c was written by Jiri Osoba (see Cc:), he probably can tell more
about this. Jiri, what do you think? How risky is it to enable JPEG/Exif
reading as Harmut suggested here?

Regards,
Thanh



More information about the pdftex mailing list