Bad pdf output if file name ends in ":" before extension

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
solstag
Posts: 1
Joined: 2016-08-03T03:58:06-07:00
Authentication code: 1151

Bad pdf output if file name ends in ":" before extension

Post by solstag »

Hi!

I believe I have found a bug.

Running:

Code: Select all

convert file1.ppm ... fileN.ppm result\:.pdf
(note the name of the outpuf file ends with a ":" before the extension!)

Generates a bad (and much larger) PDF that evince can't read (complains that ppm is not supported).

Weirdly enough that can be worked around in two ways:

By removing or appending something after the ":" in the output file name:

Code: Select all

convert file1.ppm ... fileN.ppm result\:x.pdf
By making sure the file already exists:

Code: Select all

touch result.pdf
convert file1.ppm ... fileN.ppm result\:.pdf
Either way outputs a PDF that evince reads fine, and which is much smaller in size than the first one.

I note that my version of convert is not the most recent, so sorry if this is a known bug that has been fixed:

Code: Select all

convert --version
Version: ImageMagick 6.9.2-7 Q16 x86_64 2015-12-06 http://www.imagemagick.org
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib
Cheers!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bad pdf output if file name ends in ":" before extension

Post by snibgo »

solstag wrote:touch result.pdf
convert file1.ppm ... fileN.ppm result\:.pdf
I don't see why the "touch" makes any difference. "result.pdf" is a different file to "result\:.pdf".
To some operating systems, ":" isn't a special character within filenames, so ":.pdf" is a valid filename. This isn't true of Windows.

What shell are you using? Your backslashes suggest Windows. ":.pdf" isn't a valid filename for Windows.

Another complication is that IM uses prefixes in front of filenames, separated by a colon. Hence, IM looks for colons within filenames and processes them separately.

You may be correct that this is a bug. However, I think it would be wise not to use colons within filenames for input to IM, or output from IM.
snibgo's IM pages: im.snibgo.com
Post Reply