Page 1 of 1

-scene destroys %[scene] info

Posted: 2010-08-11T11:09:18-07:00
by ProfessorJerk
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

Re: -scene destroys %[scene] info

Posted: 2010-08-11T19:09:00-07:00
by anthony
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...

Code: Select all

convert rose: granite: logo: -set mylabel '%g %[scene]  %s/%n ' -format '%[mylabel]' info:
70x46+0+0 0 0/1
128x128+0+0 0 0/1
640x480+0+0 0 0/1
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'.

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:
70x46+0+0 0 0/3
128x128+0+0 1 1/3
640x480+0+0 2 2/3
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.


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.

Re: -scene destroys %[scene] info

Posted: 2010-08-12T06:02:30-07:00
by ProfessorJerk
Thanks,

Is there a way I can mark the images with the current frame number?

Also another bug?
viewtopic.php?f=1&t=16827

Re: -scene destroys %[scene] info

Posted: 2010-08-12T22:02:11-07:00
by anthony
that is one of the bugs, otherwise you could store the frame number in a -set image property.