# [XeTeX] Wrong dimensions when using \XeTeXpicfile with CMYK image

Marcel Korpel marcel.lists at gmail.com
Mon Feb 9 00:43:42 CET 2015

A few days ago I posted a question at tex.stackexchange.com about a
wrong output of XeTeX and/or xdvipdfmx regarding jpeg images saved in
CMYK colours [0].

Consider the following example:

\nopagenumbers
% The TeXbook, p. 311
\def\hidehrule#1#2{\kern-#1%
\hrule height#1 depth#2 \kern-#2 }
\def\hidevrule#1#2{\kern-#1{\dimen0=#1
\def\makeblankbox#1#2{\hbox{\lower\dp0\vbox{\hidehrule{#1}{#2}%
\kern-#1 % overlap the rules at the corners
\hbox to \wd0{\hidevrule{#1}{#2}%
\raise\ht0\vbox to #1{}% set the vrule height
\lower\dp0\vtop to #1{}% set the vrule depth
\hfil\hidevrule{#2}{#1}}%
\kern-#1\hidehrule{#2}{#1}}}}

\def\pic#1{\setbox0=\vbox{\XeTeXpicfile #1 width 8cm}
\vbox{\leavevmode\copy0\kern-\wd0\makeblankbox{.25pt}{.25pt}}}

\pic{test-cmyk300.jpg}
\bigskip
\pic{test-cmyk72.jpg}
\bigskip
\pic{test-rgb300.jpg}
\bye

http://stackexchange.marcelkorpel.nl/test-cmyk300.jpg
http://stackexchange.marcelkorpel.nl/test-cmyk72.jpg
http://stackexchange.marcelkorpel.nl/test-rgb300.jpg

They are the same image saved in CMYK colours with an internal
resolution of 300 DPI, 72 DPI and with a resolution of 300 DPI in RGB
colours, respectively. You'll see that the 300 DPI CMYK image is set a
lot larger than the other ones, although a width of 8 cm is explicitly
given (also notice the boundaries of the \vbox). A CMYK image of 72
DPI is output exactly right, an image in a lower resolution is output
similarly smaller. I couldn't reproduce this issue with RGB pictures
[2]. Notice that all images are exactly 463x307 pixels large, *only*
the internal DPI setting differs.

At tex.stackexchange.com a moderator thinks it's a bug in xdvipdfmx.
If so, where to report it?

$xetex --version XeTeX 3.14159265-2.6-0.99991 (TeX Live 2014/Arch Linux) kpathsea version 6.2.0 Copyright 2014 SIL International, Jonathan Kew and Khaled Hosny. There is NO warranty. Redistribution of this software is covered by the terms of both the XeTeX copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the XeTeX source. Primary author of XeTeX: Jonathan Kew. Compiled with ICU version 54.1; using 54.1 Compiled with zlib version 1.2.8; using 1.2.8 Compiled with FreeType2 version 2.5.5; using 2.4.12 Compiled with Graphite2 version 1.2.4; using 1.2.4 Compiled with HarfBuzz version 0.9.38; using 0.9.38 Compiled with libpng version 1.6.16; using 1.6.16 Compiled with poppler version 0.30.0 Compiled with fontconfig version 2.11.1; using 2.11.1$ xdvipdfmx --version
This is xdvipdfmx Version 20140317 by Jonathan Kew and Jin-Hwan Cho,
modified for TeX Live […]

Regards,
Marcel

[1] Original question at
https://tex.stackexchange.com/questions/226928/wrong-dimensions-when-using-xetexpicfile-with-cmyk-image
[2] If I recall correctly I've seen an image in RGB colours at a
resolution of 71.something DPI a bit smaller than the surrounding box,
exactly like its CMYK equivalent, but I wasn't able to reproduce this
behaviour again