Page 1 of 1
File reading wildcards
Posted: 2010-03-09T09:10:03-07:00
by martron
I'm trying convert a series of images using the syntax I found on
http://www.imagemagick.org/Usage/files/ . I'm running ImageMagick 6.5.1-0 2009-08-27 Q16 OpenMP on Ubuntu Karmic.
When I run the following:
Code: Select all
convert '2010030613%02d.jpg[51-72]' wiarton.jpg
I expect that it will simply rename the chosen images to wiarton-0.jpg, wiarton-1.jpg. When run, it chooses the right files and does indeed rename them but also resizes them to 324x243. The original images are 2592x1944 and I want them to stay that way when I run the command. I think the input resize modifier might be interpreting the image sequence as resize information.
For example, if I run:
Code: Select all
convert '2010030613%02d.jpg[51-53]' wiarton.jpg
(only convert from images 51-53)
the images are resized to 1296x972.
Am I missing something about the file read modifiers? Why is this resizing happening and how can I stop it?
Thanks.
Re: File reading wildcards
Posted: 2010-03-09T09:13:58-07:00
by martron
I just ran another test and it seems as though the number of images decides what size the output will be. In other words, when converting 3 images, using [51-53] and [66-68] end up with the same size output.
Re: File reading wildcards
Posted: 2010-03-09T10:37:37-07:00
by fmw42
jpg format does not support frames as indicated by [#-##]. This syntax is only for multiframe images such as a gif animation or pages of pdf or multiframe tif.
If you have a series of image, you will need to specify each image you have. If the images are named with image-0.jpg ... image-N.jpg, then you can write a loop to process just the ones you want. There is no wildcard except for all (*) that I know about that you can use with non-frame input images.
Perhaps someone else knows more about this and can suggest another solution.
Re: File reading wildcards
Posted: 2010-03-09T10:45:50-07:00
by martron
At
http://www.imagemagick.org/Usage/files/#read_frames after showing how to read frames of an image it also states:
You can also get IM to read images based on a list of numbers. For example..
will read in the files "image_005.png", "image_006.png", and "image_007.png". With this method you can not use a negative index.
I think I'm doing that part correctly, and indeed the proper sequence of images are read. The only real problem is that they are also resized.
Re: File reading wildcards
Posted: 2010-03-09T11:09:57-07:00
by fmw42
martron wrote:At
http://www.imagemagick.org/Usage/files/#read_frames after showing how to read frames of an image it also states:
You can also get IM to read images based on a list of numbers. For example..
will read in the files "image_005.png", "image_006.png", and "image_007.png". With this method you can not use a negative index.
I think I'm doing that part correctly, and indeed the proper sequence of images are read. The only real problem is that they are also resized.
I am very surprised that this works. The page your reference says:
"Will select specific sub-frames from a
multi-image file format from the image that has been read in"
jpg and png do NOT support multi-image file formats.
However, testing does show that this does work. So I learn something new today.
Testing:
convert rose: netscape: logo: rose: netscape: logo: tmp_%d.png
convert tmp_%d.png[2-4] tmpnew.jpg
produces the correct size resulting images, tmpnew-0.jpg tmpnew-1.jpg tmpnew-2.jpg
(IM 6.6.0-5 Q16 Mac OSX Tiger)
Again, try upgrading your IM version.
But try removing the quotes around your image names.
Re: File reading wildcards
Posted: 2010-03-09T11:17:02-07:00
by martron
I think the document meant that "in addition to reading subframes from multi-image files, you can also You can also get IM to read image file based on a list of numbers."
Re: File reading wildcards
Posted: 2010-03-09T11:19:29-07:00
by fmw42
see my edited comments above
Re: File reading wildcards
Posted: 2010-03-09T14:55:56-07:00
by martron
I managed to compile 6.6 on ubuntu and now it all works as expected. Thanks!