It appears to me that the reason for this is that ImageMagick changed how it writes some metadata about resolution into the JPEG files. I did this to verify:
Code: Select all
$ convert wizard: -density 300 wiz-300densi.jpg
$ convert wizard: wiz-standard.jpg
$ identify wiz-300densi.jpg wiz-standard.jpg
wiz-300densi.jpg JPEG 480x640 480x640+0+0 8-bit sRGB 62.2KB 0.000u 0:00.000
wiz-standard.jpg[1] JPEG 480x640 480x640+0+0 8-bit sRGB 62.2KB 0.000u 0:00.000
However, LaTeX files using wiz-standard.jpg produce this error message:
Code: Select all
pdfTeX warning: pdflatex: arithmetic: number too big
pdfTeX warning: pdflatex: arithmetic: number too big
<./wiz-standard.jpg, id=4, --32768.0pt x 0.0pt>
! Package graphics Error: Division by 0.
See the graphics package documentation for explanation.
Type H <return> for immediate help.
...
l.63 \includegraphics{./wiz-standard.jpg}
?
Files which use wiz-300densi.jpg work flawlessly.
It even works flawlessly if I create the JPEGs with `-density 10` or `-density 1`.
Code: Select all
$ identify -verbose wiz-300densi.jpg > wiz-300densi.log
$ identify -verbose wiz-standard.jpg > wiz-standard.log
Code: Select all
$ sdiff -sbB wiz-densi300.log wiz-standard.log
Image: wiz-300densi.jpg | Image: wiz-standard.jpg
Resolution: 300x300 <
Print size: 1.6x2.13333 <
date:create: 2015-05-07T12:09:45+02:00 | date:create: 2015-05-07T12:09:20+02:00
date:modify: 2015-05-07T12:09:45+02:00 | date:modify: 2015-05-07T12:09:20+02:00
filename: wiz-300densi.jpg | filename: wiz-standard.jpg
$ exiftool wiz-standard.jpg | grep Resolution
Resolution Unit : inches
X Resolution : 1
Y Resolution : 1
$ exiftool wiz-300densi.jpg | grep Resolution
Resolution Unit : inches
X Resolution : 300
Y Resolution : 300
$ ls -l wiz-300densi.jpg wiz-standard.jpg
-rw-r--r-- 1 kp staff 62177 7 Mai 12:09 wiz-300densi.jpg
-rw-r--r-- 1 kp staff 62177 7 Mai 12:09 wiz-standard.jpg
Therefore, currently I think that this is a flaw or bug in LaTeX/pdflatex. (After all, I think it is stupid for pdflatex/lualatex/xelatex to rely on this metadata info in the JPEG and to kill itself if that is found empty. Instead it should gracefully work with the pixels which are there, or assume some other resolution value: Because the actual value of that metadata doesn’t matter anyway: I can use `-density 300` or `-density 10` when creating the JPEG — on the page image there is no difference.)
Why do I bring it up in this forum then?
Well, one thing after the other... I'll be sure to report this to some appropriate LaTeX forum too and see what they think of it.
I only would like to know from you guys:
- Has this IM behavior when producing JPEGs been changed in recent versions of ImageMagick? (I'm asking because I seem to remember that the same procedure -- JPEGs generated by IM from `wizard:` and `logo:` and using them in LaTeX's PDF output -- did work a year or so ago...)
- If so, was this change on purpose? Or did it happen by accident, and could possibly be reverted?
- Is there any (official or inofficial) "standard" for JPEGs which are expecting a valid entry about the desired rendering resolution inside their metadata? (In this case it could be argued that LaTeX is "right" to assume proper values to work with -- otherwise it's the contrary.)