I'm trying to insert an image, which I've done probably a thousand times before, but I'm having issues with this one.

The image is a jpg I just created in Paint - it's not excessively large or high resolution.

enter image description here

The original image is available here.

I'm using the regular ol' \includegraphics command in the graphicx package, and the PDF will compile but the image will not show up and the log file says:

"pdflatex.exe: arithmetic: number too big"

I've tried scaling on the off chance that the picture is too big (which it really isn't - it's 640x480 pixels) but I'm still getting the error.

Here's the relevant code:


After a quick Google search I saw that somebody suggested \pdfimageresolution=72 which seemed to fix the problem for that person, but it isn't working for me. Any suggestions?

  • 1
    Can you upload the image somewhere and put a link to it in your question? Please add an example code as well so that others have everything necessary to reproduce the problem. This will make it much easier to help you. – Ian Thompson Oct 15 '14 at 20:40
  • Welcome to TeX.SX by the way. – Ian Thompson Oct 15 '14 at 20:42
  • Image and code are now added -- hopefully should be clear now. – pocketlizard Oct 15 '14 at 20:50
  • @pocketlizard I added the image directly into this post so that the image stays associated with the post even when TinyPic deletes it. Hope you don't mind! Welcome to TeX.SX! – darthbith Oct 15 '14 at 20:56
  • 1
    I saved the uploaded version by @darthbith and was able to compile, so mission accomplished. However, I'm still very curious about what this actually means! I'll leave the question open in case somebody has some insight or knows more about jpg and the error. Thanks all! – pocketlizard Oct 16 '14 at 12:22

I believe your problem is due to the resolution (in dots per inch, not the number of pixels!) stored in the image file. I had the same problem with an image having a ridiculously low resolution (1 dpi or less, displayed as 1 dpi in GIMP). Saving the JPEG image again or recompressing to PNG did not help at all, but setting a reasonable resolution (e.g., 300 dpi) did.

Your image seems to have the same problem:

% file 14345le.jpg
14345le.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 1x1, segment length 16, comment: " Image generated by Aladdin Ghostscript (device=pnmraw)", baseline, precision 8, 640x480, frames 3

Note the "density 1x1" bit. You can see the same information in the GIMP and modify it through the Image → Scale Image dialog box, then export using the File menu to save the modified image. Beware that you will lose quality unless you choose a lossless compression format such as PNG.

I'm not a pdfTeX expert, but I think the origin of the problem is that given enough pixels, a ridiculously low resolution is guaranteed to result in dimensions that exceed \maxdimen, the largest length that TeX can deal with. For instance, with your 640x480 image at 1 dpi, you get a width of (640/1)*72.27 = 46252.8pt, which exceeds \maxdimen = 16383.99999pt (according to https://tex.stackexchange.com/a/430/73317).

  • The error message likely comes from a check if the image sizes are less than 100 inch x 100 inch, which will most likely fail if the image claims a dpi of 1. – Martin Schröder May 2 '15 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.