[pdftex] graphic{s,x} PNG + pdflatex bug

George N. White III gnwiii at gmail.com
Thu May 6 20:36:10 CEST 2010


On Thu, May 6, 2010 at 2:33 PM, Taco Hoekwater <taco at elvenkind.com> wrote:
> Nico Schlömer wrote:
>>
>> Hi all,
>>
>> I experienced a weird bug using \includegraphics of the graphicx
>> package with pdflatex 1.40.10.
>>
>> I try to load the attached PNG file, and unlike with other PNG files,
>> pdflatex would just bail out with
>>
>> ==================== *snip* ====================
>> [...]
>> [Loading MPS to PDF converter (version 2006.09.02).]
>> )
>> ! Dimension too large.
>> <argument> \wd \@tempboxa
>> l.7 \includegraphics{img1.png}
>> ?
>> ==================== *snap* ====================
>>
>> David Carlisle, maintainer of graphicx, suggests that may be a bug in
>> pdflatex -- What do you reckon?
>
> Well, this png specifies a resolution of 0.9906 pixel per inch so it
> has natural sizes of about 252 inch (6.4m). So in my opinion something
> *is* wrong with the png.
>
> Best wishes,
> Taco

$ identify -verbose img1.png |head
Image: img1.png
  Format: PNG (Portable Network Graphics)
  Class: DirectClass
  Geometry: 250x250+0+0
  Resolution: 0.39x0.39
  Print size: 641.026x641.026
  Units: PixelsPerCentimeter

I loaded the PNG in Adobe Photoshop and saved it as  img2.png:

$ identify -verbose img2.png |head
Image: img2.png
  Format: PNG (Portable Network Graphics)
  Class: DirectClass
  Geometry: 250x250+0+0
  Resolution: 0.39x0.39
  Print size: 641.026x641.026
  Units: PixelsPerCentimeter

$ pngcheck -vt img1.png
File: img1.png (92868 bytes)
  chunk IHDR at offset 0x0000c, length 13
    250 x 250 image, 32-bit RGB+alpha, non-interlaced
  chunk sBIT at offset 0x00025, length 4
    red = 8 = 0x08, green = 8 = 0x08, blue = 8 = 0x08, alpha = 8 = 0x08
  chunk pHYs at offset 0x00035, length 9: 39x39 pixels/meter (1 dpi)
  chunk IDAT at offset 0x0004a, length 8192
    zlib: deflated, 32K window, default compression
  chunk IDAT at offset 0x02056, length 8192
  chunk IDAT at offset 0x04062, length 8192
  chunk IDAT at offset 0x0606e, length 8192
  chunk IDAT at offset 0x0807a, length 8192
  chunk IDAT at offset 0x0a086, length 8192
  chunk IDAT at offset 0x0c092, length 8192
  chunk IDAT at offset 0x0e09e, length 8192
  chunk IDAT at offset 0x100aa, length 8192
  chunk IDAT at offset 0x120b6, length 8192
  chunk IDAT at offset 0x140c2, length 8192
  chunk IDAT at offset 0x160ce, length 2530
  chunk IEND at offset 0x16abc, length 0
No errors detected in img1.png (16 chunks, 62.9% compression).
$ pngcheck -vt img2.png
File: img2.png (92076 bytes)
  chunk IHDR at offset 0x0000c, length 13
    250 x 250 image, 32-bit RGB+alpha, non-interlaced
  chunk bKGD at offset 0x00025, length 6
    red = 0x00ff, green = 0x00ff, blue = 0x00ff
  chunk pHYs at offset 0x00037, length 9: 39x39 pixels/meter (1 dpi)
  chunk vpAg at offset 0x0004c, length 9
    unknown private, ancillary, safe-to-copy chunk
  chunk IDAT at offset 0x00061, length 32768
    zlib: deflated, 32K window, maximum compression
  chunk IDAT at offset 0x0806d, length 32768
  chunk IDAT at offset 0x10079, length 26301
  chunk tEXt at offset 0x16742, length 37, keyword: create-date
    2010-05-06T12:39:23-03:00
  chunk tEXt at offset 0x16773, length 37, keyword: modify-date
    2010-05-06T12:35:33-03:00
  chunk IEND at offset 0x167a4, length 0
No errors detected in img2.png (10 chunks, 63.2% compression).

Both versions look the same using Imagemagick's display,
but img2.png does not give the error, so image size does
not explain the error.



-- 
George N. White III <aa056 at chebucto.ns.ca>
Head of St. Margarets Bay, Nova Scotia



More information about the pdftex mailing list