[XeTeX] jpg image and text overlapping

Stefan Solbrig stefan.solbrig at ur.de
Mon Aug 4 19:50:27 CEST 2014


> Turns out we've also been bit by this problem... please see my  
> questions below.
>
> On 2014-08-04 01:55, Heiko Oberdiek wrote:
>> On 04.08.2014 01:27, Gildas Hamel wrote:
>>> I append the jpg file (tombe.jpg).
>> The resolution data in tombe.jpg are inconsistent:
>> * JFIF header: 72 DPI
>> * EXIF header: 300 DPI
>
> What program did you use to determine this?  I'm looking at one of  
> our jpgs in a text editor, and while I see the string "Exif" near  
> the top, I don't see any jfif-like string.  GIMP reports 72x72 ppi,  
> but I don't know whether that's exif or jfif.
>
>> Apparently XeTeX uses the EXIF header, whereas xdvipdfmx the JFIF  
>> header
>> (or vice versa).
>
> Is there a work-around?  Like using some image editor to produce a  
> jpg file with jfif and exif headers that agree on the resolution  
> (and I suppose have the correct one :-)), or maybe converting from  
> jpg to some other format?  I suppose I could create a PDF using  
> pdflatex, and import that into my xetex file instead of the original  
> jpg.  But before I try all these things, it would be nice to know if  
> someone else has found a work-around...

There is a tool named "exiftool" that can do this. It modifies image  
metadata without changing the image itself. You can install it either  
via a package manger (in Debian it's "libimage-exiftool-perl") or you  
can install it via CPAN (the perl package manager, because it it part  
of a perl package. If you use cpan, do:
   cpan
   cpan>  install Image::ExifTool

The following two commands will set all resolution metadata known to  
exiftool to 300.

    exiftool -'*Resolution'=300 image.jpg

I haven't done a thorough testing of this tool, but for OP's image, it  
worked. (The command might need some refinement, depending on your  
needs.)

To just read all the metadata, do

   exiftool -v image.jpg





More information about the XeTeX mailing list