Re: convert - special characters in file name
Bob Friesenhahn <[email protected]> Tue, 7 May 2019 08:07:32 -0500 (CDT)
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 7 May 2019, Test User wrote: > Hello all, > > I am running GraphicsMagick 1.3.22 compiled from source by me with MinGW on > Windows. > > If the input file name starts with the "at" sign (@), for example @test.tif, > convert fails with `Unable to open file (II*) [Invalid argument]'. IF the > file name is @pvn01!.tif then the message is `Unable to open file > (pvn01!.tif) [No such file or directory]'. Dear mysterious "Test User", GraphicsMagick 1.3.22 is way out of date (from October 4, 2015) and the current release is 1.3.32. You should subscribe to this mailing list before posting to it. Your posting only made it here due to list moderator activity. > When running a commandline utility, you can prepend an at sign @ to a > filename to read a list of image filenames from that file. This is convenient > in the event you have too many image filenames to fit on the command line. > ... > > This explains the first error message but not the second, especially since > test.tif is a copy of @pvn01!.tif. > > 1) What is going on with the @? With current code, I did a test and it worked. I did gm convert rose: @rose.gif and then this did work: gm convert @rose.gif out.gif but when I did gm convert rose: @rose.gif cp @rose.gif rose.gif gm convert @rose.gif out.gif things did not work out so well since there was a valid file name matching '@rose.gif' with the '@' removed and GM tried to read it as a list of input files. Perhaps it could have tried applying file header magic tests first and guess that it is actually a GIF file but of course this is not assured to work for all formats. > 2) Are there other special characters that are legal in Windows filenames > that cause trouble for convert? I don't know. I would worry about directory separator characters in file names (e.g. '\' for Windows). These are not allowed at all under Unix but perhaps Windows might allow embedding them in a file name. > I worked around the problem like this: > `gm convert .\@pvn01!.tif test.pdf' > but I may not have that option with special characters within the file name. I definitely recommend updating your software to a more current version. Given that you compiled from source code, you have the power to comment out the code which supports reading command-line input from files prefixed with @. On the flip side, you could put the actual file name in a text file with its name prefixed with a '@' and then use that to read from one or more files with no more '@' handling to worry about and no more arbitrary command line limitations. Bob -- Bob Friesenhahn [email protected], http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt