Hey there,
I've been working for a while trying to figure out why I can't seem to get proper frame numbers on my images. I'm now fairly certain that there is a bug with the -scene option that pollutes the %[scene] values. In the example below, the first frame is labeled correctly, but then all subsequent frames seem to have the same incorrect value.
convert infile-%04d.tif[1-3] -annotate 0 "frame# %[scene]" -scene 4 outfile-%04d.tif
Trying to work around this issue I instead tried to auto-generate the code that will calculate the frame number using %[fx:t+" + str(startFrame) + "]
This too seems to be polluted by the use of -scene. My frame numbers appear correctly if I do not use -scene.
Cheers,
Jesse
-scene destroys %[scene] info
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: -scene destroys %[scene] info
This would be a bug. But not with -scene but with the way IM handles operators that deal with 'single image processing' options.
For example -annotate -draw -rotate -distort. As distinct from operators that deal with a image list, like -layers -flatten -morph.
What happens is that such operators are applied in a loop over each image as a single image, separated from the rest of the image list. As such when -annotate (or other such operations) is executed it sees only ONE image. That image is in a list by itself, and as such only has one 'zero index' image in it.
This also applies to -set...
This does NOT apply to -format and info: as -format stores the actual string for later processing by info: which is a image list operator as it is an image writing operator getting the full list of images. As such...
This is bug which I reported long ago, When I was looking at a way to set percent exscape options (-distort args actually) to generate a animation from a image sequence but could not get a 'scene number' to use as a index to the math.
For example -annotate -draw -rotate -distort. As distinct from operators that deal with a image list, like -layers -flatten -morph.
What happens is that such operators are applied in a loop over each image as a single image, separated from the rest of the image list. As such when -annotate (or other such operations) is executed it sees only ONE image. That image is in a list by itself, and as such only has one 'zero index' image in it.
This also applies to -set...
Code: Select all
convert rose: granite: logo: -set mylabel '%g %[scene] %s/%n ' -format '%[mylabel]' info:
Whcih shows each and every image was the 'zero' image in a list of 1 images! That is because the percent escapes was expanded at the -set operation which is applied to ONE IMAGE AT A TIME. That is -set like -annotate is a 'looped single image operator'.70x46+0+0 0 0/1
128x128+0+0 0 0/1
640x480+0+0 0 0/1
This does NOT apply to -format and info: as -format stores the actual string for later processing by info: which is a image list operator as it is an image writing operator getting the full list of images. As such...
Code: Select all
convert rose: granite: logo: -format '%g %[scene] %s/%n' info:
The value of -scene here does NOT matter as only the image write (a image list operator) will see the images AS a list of images.70x46+0+0 0 0/3
128x128+0+0 1 1/3
640x480+0+0 2 2/3
This is bug which I reported long ago, When I was looking at a way to set percent exscape options (-distort args actually) to generate a animation from a image sequence but could not get a 'scene number' to use as a index to the math.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: -scene destroys %[scene] info
Thanks,
Is there a way I can mark the images with the current frame number?
Also another bug?
viewtopic.php?f=1&t=16827
Is there a way I can mark the images with the current frame number?
Also another bug?
viewtopic.php?f=1&t=16827
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: -scene destroys %[scene] info
that is one of the bugs, otherwise you could store the frame number in a -set image property.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/