[Pkg-gmagick-im-team] Bug#1115346: Lower bottom is cut away, and empty space is added to the top right when converting PNG to PDF
Md Ayquassar
MdAyq5 at ro.ru
Tue Jun 2 07:40:37 BST 2026
retitle 1115346 Lower bottom is cut away, and empty space added to the top right when converting PNG to PDF
affects 1115346 + pngtools libimage-exiftool-perl pngcheck
severity 1115346 important
quit
Consider test.png in the attachment. Open it with loupe, display, or eog, and you'll see a cross in a rectangle, and there is nothing outside the rectangle. We see nothing unusual so far:
$ pnginfo test.png
test.png...
Image Width: 100 Image Length: 166
Bitdepth (Bits/Sample): 8
Channels (Samples/Pixel): 1
Pixel depth (Pixel Depth): 8
Colour Type (Photometric Interpretation): GRAYSCALE
Image filter: Single row per byte filter
Interlacing: No interlacing
Compression Scheme: Deflate method 8, 32k window
Resolution: (not specified)
FillOrder: msb-to-lsb
Byte Order: Network (Big Endian)
Number of text strings: 0
$ exiftool -a -G test.png
[ExifTool] ExifTool Version Number : 13.25
[File] File Name : test.png
[File] Directory : .
[File] File Size : 493 bytes
[File] File Modification Date/Time : 2026:06:02 08:02:41+02:00
[File] File Access Date/Time : 2026:06:02 08:05:45+02:00
[File] File Inode Change Date/Time : 2026:06:02 08:03:31+02:00
[File] File Permissions : -rw-rw-r--
[File] File Type : PNG
[File] File Type Extension : png
[File] MIME Type : image/png
[PNG] Image Width : 100
[PNG] Image Height : 166
[PNG] Bit Depth : 8
[PNG] Color Type : Grayscale
[PNG] Compression : Deflate/Inflate
[PNG] Filter : Adaptive
[PNG] Interlace : Noninterlaced
[Composite] Image Size : 100x166
[Composite] Megapixels : 0.017
$ file test.png
test.png: PNG image data, 100 x 166, 8-bit grayscale, non-interlaced
$ pngcheck test.png
zlib warning: different version (expected 1.2.13, using 1.3.1)
OK: test.png (100x166, 8-bit grayscale, non-interlaced, 97.0%).
Now run
magick test.png test.pdf
or
convert test.png test.pdf
followed by
$ pdfinfo test.pdf
Title: test
Author: https://imagemagick.org
Creator: https://imagemagick.org
Producer: https://imagemagick.org
CreationDate: Tue Jun 2 07:46:05 2026 CEST
ModDate: Tue Jun 2 07:46:05 2026 CEST
Custom Metadata: no
Metadata Stream: no
Tagged: no
UserProperties: no
Suspects: no
Form: none
JavaScript: no
Pages: 1
Encrypted: no
Page size: 3964 x 6509 pts
Page rot: 0
File size: 3111 bytes
Optimized: no
PDF version: 1.3
The page size of the PDF file is now huge. However, for the original PNG file, it was not reported by `pnginfo`, `exiftool`, `pngcheck`, or `file`, and it was not noticeable in any of the three image viewers.
Open test.pdf in evince, and observe lots of free space to the right and above the rectangle with a cross. Also, the lower left part of the rectangle with a cross is missing. Clearly, this is not intended. We expect that the target PDF is visibly the same as the original PNG. If a clean conversion cannot be done or doesn't make sense, an error should be reported or the user should be warned at the very least.
In retrospect, we found caNv to be the culprit. No idea which tool added this.
Raising severity as this bug silently makes your life hard: you don't notice that your original PNG files are unusual until after the conversion to a PDF. It's even worse: the target PDF might have only few columns/lines missing on the left/bottom, and it might have only few white lines/columns added to the top/right; these are hard to see, and the wrong PDF might even get shipped to the receiver before you notice this error (if ever).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 3111 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-gmagick-im-team/attachments/20260602/58d089f6/attachment.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 493 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-gmagick-im-team/attachments/20260602/58d089f6/attachment.png>
More information about the Pkg-gmagick-im-team
mailing list