Cannot process file page when the file path contains colon

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
tlichev
Posts: 16
Joined: 2012-06-27T04:05:56-07:00
Authentication code: 13

Cannot process file page when the file path contains colon

Post by tlichev »

Hi all,
I already reported such a bug (unfortunately in wrong forum, sorry for that), but now I hit the same problem again, with newer version.
Here is the link to my previous post:
viewtopic.php?f=1&t=21314

Now I upgraded to ImageMagick 6.9.2-0 Q16 x86_64 and I got the same problem
The error occurs when there is a colon in the file path and when I'm trying to process only certain page/s from the file

Example that produces an error:

Code: Select all

convert /s:/mypictures/test1.pdf[1] test.jpg
The command works when there is no colon or page modifier:

Code: Select all

convert /s:/mypictures/test1.pdf test.jpg
or

Code: Select all

convert /nocolonpath/test1.pdf[1] test.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cannot process file page when the file path contains colon

Post by fmw42 »

Does it fail in IM 6.9.2.4 (current release)? Does it fail if you put double quotes about the filename? What is your platform?
tlichev
Posts: 16
Joined: 2012-06-27T04:05:56-07:00
Authentication code: 13

Re: Cannot process file page when the file path contains colon

Post by tlichev »

Sorry for the missing info
My platform is ArchLinux x64
Currently it is not possible for me to upgrade to 6.9.2.4, so I cannot test with it now
Tried with quotes, escaping the colon - no luck
As far as I know the problem exists only on Linux (don't know about other Unix systems ...)

Code: Select all

[user@local]$ convert /tmp/s:/test.pdf[0] test.jpg
convert: unable to open image `/test.pdf': No such file or directory @ error/blob.c/OpenBlob/2695.
convert: no decode delegate for this image format `/TMP/S' @ error/constitute.c/ReadImage/501.
convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3230.

[user@local]$ convert /tmp/s\:/test.pdf[0] test.jpg
convert: unable to open image `/test.pdf': No such file or directory @ error/blob.c/OpenBlob/2695.
convert: no decode delegate for this image format `/TMP/S' @ error/constitute.c/ReadImage/501.
convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3230.

[user@local]$ convert "/tmp/s:/test.pdf[0]" test.jpg
convert: unable to open image `/test.pdf': No such file or directory @ error/blob.c/OpenBlob/2695.
convert: no decode delegate for this image format `/TMP/S' @ error/constitute.c/ReadImage/501.
convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3230.

[user@local]$ convert "/tmp/s:/test.pdf"[0] test.jpg
convert: unable to open image `/test.pdf': No such file or directory @ error/blob.c/OpenBlob/2695.
convert: no decode delegate for this image format `/TMP/S' @ error/constitute.c/ReadImage/501.
convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3230.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Cannot process file page when the file path contains colon

Post by glennrp »

It is a feature, not a bug. The part of the filename up to the first colon is a format. Just put a format (pdf:) in your case, at the beginning of the filename:

Code: Select all

convert pdf:/tmp/s:/test.pdf[0] test.jpg
works for me with the current IM running on Ubuntu.
tlichev
Posts: 16
Joined: 2012-06-27T04:05:56-07:00
Authentication code: 13

Re: Cannot process file page when the file path contains colon

Post by tlichev »

Thanks!
I tested on my system and it works this way.
Actually the error message says it, but now I understand :)
But what if I want to leave the format recognition to IM ?
There should be a way to escape/quote the file path. It may contain characters that are internally used by IM for some logic and are allowed symbols for file path. For example what if IM is working with user folders and there is no control over the characters the file path may contain?
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Cannot process file page when the file path contains colon

Post by glennrp »

tlichev wrote: But what if I want to leave the format recognition to IM ?

Code: Select all

convert :/tmp/s:/test.pdf[0] test.jpg
The leading colon in effect escapes the second one, without defining a format.
tlichev
Posts: 16
Joined: 2012-06-27T04:05:56-07:00
Authentication code: 13

Re: Cannot process file page when the file path contains colon

Post by tlichev »

Thanks! It works perfectly now
Post Reply