Page 1 of 1

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

Posted: 2016-08-03T06:06:48-07:00
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!

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

Posted: 2016-08-03T07:17:04-07:00
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.