read frame syntax doesn't work when filename contains ':'
-
- Posts: 5
- Joined: 2011-08-02T15:04:48-07:00
- Authentication code: 8675308
read frame syntax doesn't work when filename contains ':'
convert has a problem when the input filename contains ':' - e.g in a timestamp - and I use [0] to specify the first image frame.
$ convert -resize 1024x600 -verbose test-18\:37.jpg small/test-18\:37.jpg
test-18:37.jpg JPEG 1944x2592 1944x2592+0+0 8-bit DirectClass 2.651MB 0.130u 0:00.139
test-18:37.jpg=>small/test-18:37.jpg JPEG 1944x2592=>450x600 450x600+0+0 8-bit DirectClass 147KB 0.500u 0:00.240
$ convert -resize 1024x600 -verbose test-18\:37.jpg[0] small/test-18\:37.jpg
convert: no decode delegate for this image format `37.jpg' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `small/test-18:37.jpg' @ error/convert.c/ConvertImageCommand/2949.
whereas both versions work if the file is named "test.jpg".
This worked in fedora 13 and doesn't in fedora 15:
bash-4.1.7-1.fc13.x86_64 -> bash-4.2.10-4.fc15.x86_64
ImageMagick-6.5.8.10-7.fc13.x86_64 -> ImageMagick-6.6.5.10-19.fc15.x86_64
$ convert -resize 1024x600 -verbose test-18\:37.jpg small/test-18\:37.jpg
test-18:37.jpg JPEG 1944x2592 1944x2592+0+0 8-bit DirectClass 2.651MB 0.130u 0:00.139
test-18:37.jpg=>small/test-18:37.jpg JPEG 1944x2592=>450x600 450x600+0+0 8-bit DirectClass 147KB 0.500u 0:00.240
$ convert -resize 1024x600 -verbose test-18\:37.jpg[0] small/test-18\:37.jpg
convert: no decode delegate for this image format `37.jpg' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `small/test-18:37.jpg' @ error/convert.c/ConvertImageCommand/2949.
whereas both versions work if the file is named "test.jpg".
This worked in fedora 13 and doesn't in fedora 15:
bash-4.1.7-1.fc13.x86_64 -> bash-4.2.10-4.fc15.x86_64
ImageMagick-6.5.8.10-7.fc13.x86_64 -> ImageMagick-6.6.5.10-19.fc15.x86_64
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: read frame syntax doesn't work when filename contains ':
try putting quotes around your filenames
convert -resize 1024x600 -verbose "test-18\:37.jpg" "small/test-18\:37.jpg"
better syntax would be:
convert "test-18\:37.jpg" -resize 1024x600 -verbose "small/test-18\:37.jpg"
see
http://www.imagemagick.org/Usage/basics/#why
convert -resize 1024x600 -verbose "test-18\:37.jpg" "small/test-18\:37.jpg"
better syntax would be:
convert "test-18\:37.jpg" -resize 1024x600 -verbose "small/test-18\:37.jpg"
see
http://www.imagemagick.org/Usage/basics/#why
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: read frame syntax doesn't work when filename contains ':
Note that using '\:' in a filename works because then IM is escaping its special meaning of ':'.
that same goes for meta-charcaters such as '?' and '*'.
Remember not only does the shell handle meta-characters (unless that argument is quoted) but IM also does its own form of meta-character handling in filenames.
For example
is expanded by the shell BEFORE passing the filenames to IM, while
passes just "*.jpg" whcih IM then expands into a internal list of filenames! (provided for Windows Dos support, and preventing command line limit overflows).
As such to actually get IM to read a file names literially named on disk as '*.jpg' you need to use any of the following forms...
NOTE; the second line is NOT recommended as some shells (not bash) and some APIs (C programs, possibly PHP) may actually remove the single backslash, and pass '*.jpg' to IM which it will again expand!
On top of '?' and '*', IM also adds the meta-character handling of ':', '%' and '[...]' for read modifier handling. These however have a different meaning (codec specification, scene number inclusion, and read modifiers) to normal shell syntax of those meta-characters.
This is something I'll add to IM examples, File Handling Reading.
It would also probably solve problems that Window uses have with dos drive letters.
that same goes for meta-charcaters such as '?' and '*'.
Remember not only does the shell handle meta-characters (unless that argument is quoted) but IM also does its own form of meta-character handling in filenames.
For example
Code: Select all
convert *.jpg ....
Code: Select all
convert '*.jpg' ....
As such to actually get IM to read a file names literially named on disk as '*.jpg' you need to use any of the following forms...
Code: Select all
convert '\*.jpg' ....
convert "\*.jpg" ....
convert "\\*.jpg" ....
convert \\\*.jpg ....
On top of '?' and '*', IM also adds the meta-character handling of ':', '%' and '[...]' for read modifier handling. These however have a different meaning (codec specification, scene number inclusion, and read modifiers) to normal shell syntax of those meta-characters.
This is something I'll add to IM examples, File Handling Reading.
It would also probably solve problems that Window uses have with dos drive letters.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: read frame syntax doesn't work when filename contains ':
An alternative is to use a question mark...
However that may also match another file such as "time_10_30.jpg" as well!
Code: Select all
convert "time_10?30.jpg" ...
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 5
- Joined: 2011-08-02T15:04:48-07:00
- Authentication code: 8675308
Re: read frame syntax doesn't work when filename contains ':
None of that seems to work, maybe I'm missing something. It's the combination of the colon and the '[0]' modifier at the end that causes problems.
I've played around a little but still can't work out what combination of quotes and escapes will make this work:
I've played around a little but still can't work out what combination of quotes and escapes will make this work:
Code: Select all
$ convert -resize 1024x600 -verbose test-18\:37.jpg[0] small/test-18\:37.jpg
convert: no decode delegate for this image format `37.jpg' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `small/test-18:37.jpg' @ error/convert.c/ConvertImageCommand/2949.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: read frame syntax doesn't work when filename contains ':
try
convert "test-18:37.jpg[0]" -resize 1024x600 -verbose "small/test-18:37.jpg"
convert "test-18:37.jpg[0]" -resize 1024x600 -verbose "small/test-18:37.jpg"
-
- Posts: 5
- Joined: 2011-08-02T15:04:48-07:00
- Authentication code: 8675308
Re: read frame syntax doesn't work when filename contains ':
Doesn't work.fmw42 wrote:try
convert "test-18:37.jpg[0]" -resize 1024x600 -verbose "small/test-18:37.jpg"
I started testing old livecds to see when it stopped working
Code: Select all
ImageMagick Bash
GOOD 6.5.8.10-6.fc13 4.1.2-4.fc13
GOOD 6.5.8.10-6.fc13 4.1.7-1.fc13
GOOD 6.5.8.10-7.fc13 4.1.7-1.fc13
BAD 6.6.4.1-14.fc14 4.1.7-3.fc14
Re: read frame syntax doesn't work when filename contains ':
We can reproduce the problem you posted and will have a patch to fix it within a day or two. Thanks.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: read frame syntax doesn't work when filename contains ':
hmmmm
seems to work fine
The use of '[0]' read modifier with JPEG is redundant as JPEG can only contain one image. however...
failure.
also failed.
Presumably filename parsing when a read modifier is present is at fault.
Does not matter what type of read modifier either.
Downloading latest IMv6 SVN changes now.. Not fixed yet.
Code: Select all
convert rose: t.jpg
mv t.jpg test-18:37.jpg
convert test-18:37.jpg info:
test-18:37.jpg JPEG 70x46 70x46+0+0 8-bit DirectClass 2.05KB 0.000u 0:00.010
The use of '[0]' read modifier with JPEG is redundant as JPEG can only contain one image. however...
Code: Select all
convert test-18:37.jpg'[0]' info:convert test-18:37.jpg'[0]' info:
convert: no decode delegate for this image format `37.jpg' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `info:' @ error/convert.c/ConvertImageCommand/3015.
Code: Select all
convert 'test-18\:37.jpg[0]' info:
convert: no decode delegate for this image format `37.jpg' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `info:' @ error/convert.c/ConvertImageCommand/3015.
Presumably filename parsing when a read modifier is present is at fault.
Code: Select all
convert 'test-18\:37.jpg[10x10+10+10]' info:
convert: no decode delegate for this image format `37.jpg' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `info:' @ error/convert.c/ConvertImageCommand/3015.
Downloading latest IMv6 SVN changes now.. Not fixed yet.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 5
- Joined: 2011-08-02T15:04:48-07:00
- Authentication code: 8675308
Re: read frame syntax doesn't work when filename contains ':
Note for interest: this comes from digikam (really kipi-plugins) which is how I first noticed the problem.anthony wrote:The use of '[0]' read modifier with JPEG is redundant as JPEG can only contain one image
It looks like the kipi-plugin batch resizer works by building a 'convert' command to run for every file being processed, like so. The '[0]' read modifier seems to have been added to prevent problems with files containing thumbnails - is doing this for all ImageMagick commands too broad a brush?
Re: read frame syntax doesn't work when filename contains ':
Grab ImageMagick-6.7.1-2. We verified that the test-18:37.jpg[0] filename works fine with it.
-
- Posts: 5
- Joined: 2011-08-02T15:04:48-07:00
- Authentication code: 8675308
Re: read frame syntax doesn't work when filename contains ':
The stars were finally right and I managed to test this, and the fix does indeed work. Tested both by backporting into a locally built rpm in Fedora 15 and by testing 6.7.1-9 in a F16 virtual machine.
Thank, belatedly.
Thank, belatedly.
Re: read frame syntax doesn't work when filename contains ':
Hello,
Recently we upgraded ImageMagick from
to
And this problem appeared again. Using [0] on any file yields
Problem appears on FreeBSD 7.3-RELEASE-p2 (compiled from ports collection) and on Windows-64-static build.
Recently we upgraded ImageMagick from
Code: Select all
Version: ImageMagick 6.6.7-10 2011-04-08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Code: Select all
Version: ImageMagick 6.7.3-0 2011-10-12 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Code: Select all
convert: unable to open image `/path/filename.jpg[0]': No such file or directory @ error/blob.c/OpenBlob/2589.
Re: read frame syntax doesn't work when filename contains ':
We can reproduce this problem and will have a patch in ImageMagick 6.7.3-1 Beta by sometime tomorrow. Thanks.