animated gif speed [message #87583] |
Sat, 15 February 2014 15:41  |
Paul Levine
Messages: 29 Registered: February 2008
|
Junior Member |
|
|
So far, when it comes to animations, my needs have been very simple,
and I have been able to accomplish what I want (using new graphics)
with the /APPEND keyword to the write method and the GIF file suffix,
which gives me a nice little animated gif.
Now I would like to be able to control the "playback speed" of the
animated gif, which if I understand correctly, is basically a delay (in
1/100th of a second) specified for each frame that it waits before
advancing to the subsequent frame. But it seems my rather simple method
is too limited for this, as there is no DELAY_TIME keyword in new
graphics as there is in the WRITE_GIF procedure.
I have looked at http://www.idlcoyote.com/tips/howmovie.html but as I
am an IDL neophyte with a less-than-rudimentary understanding of how to
use objects, it will take some substantial learning on my part to
figure out how to actually implement any of that advice. Of course,
learning is never a bad thing, but with the limited time I have, I am
trying to figure out whether I would be better served learning the ins
and outs of the IDLffVideoWrite object (and object oriented programming
in general) or whether there is an easier way to take the output of my
already-existing function graphics and create an animated GIF (or
otherwise) with control over the playback speed
Thanks in advance!
|
|
|
Re: animated gif speed [message #87584 is a reply to message #87583] |
Sat, 15 February 2014 15:53   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul Levine writes:
> So far, when it comes to animations, my needs have been very simple,
> and I have been able to accomplish what I want (using new graphics)
> with the /APPEND keyword to the write method and the GIF file suffix,
> which gives me a nice little animated gif.
>
> Now I would like to be able to control the "playback speed" of the
> animated gif, which if I understand correctly, is basically a delay (in
> 1/100th of a second) specified for each frame that it waits before
> advancing to the subsequent frame. But it seems my rather simple method
> is too limited for this, as there is no DELAY_TIME keyword in new
> graphics as there is in the WRITE_GIF procedure.
>
> I have looked at http://www.idlcoyote.com/tips/howmovie.html but as I
> am an IDL neophyte with a less-than-rudimentary understanding of how to
> use objects, it will take some substantial learning on my part to
> figure out how to actually implement any of that advice. Of course,
> learning is never a bad thing, but with the limited time I have, I am
> trying to figure out whether I would be better served learning the ins
> and outs of the IDLffVideoWrite object (and object oriented programming
> in general) or whether there is an easier way to take the output of my
> already-existing function graphics and create an animated GIF (or
> otherwise) with control over the playback speed
I'm guessing it might take 5 or 10 seconds to learn how to use
IDLffVideoWrite, assuming you have GIF files sitting around somewhere.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: animated gif speed [message #87585 is a reply to message #87584] |
Sat, 15 February 2014 16:15   |
Paul Levine
Messages: 29 Registered: February 2008
|
Junior Member |
|
|
On 2014-02-15 23:53:13 +0000, David Fanning said:
> Paul Levine writes:
>
>> So far, when it comes to animations, my needs have been very simple,
>> and I have been able to accomplish what I want (using new graphics)
>> with the /APPEND keyword to the write method and the GIF file suffix,
>> which gives me a nice little animated gif.
>>
>> Now I would like to be able to control the "playback speed" of the
>> animated gif, which if I understand correctly, is basically a delay (in
>> 1/100th of a second) specified for each frame that it waits before
>> advancing to the subsequent frame. But it seems my rather simple method
>> is too limited for this, as there is no DELAY_TIME keyword in new
>> graphics as there is in the WRITE_GIF procedure.
>>
>> I have looked at http://www.idlcoyote.com/tips/howmovie.html but as I
>> am an IDL neophyte with a less-than-rudimentary understanding of how to
>> use objects, it will take some substantial learning on my part to
>> figure out how to actually implement any of that advice. Of course,
>> learning is never a bad thing, but with the limited time I have, I am
>> trying to figure out whether I would be better served learning the ins
>> and outs of the IDLffVideoWrite object (and object oriented programming
>> in general) or whether there is an easier way to take the output of my
>> already-existing function graphics and create an animated GIF (or
>> otherwise) with control over the playback speed
>
> I'm guessing it might take 5 or 10 seconds to learn how to use
> IDLffVideoWrite, assuming you have GIF files sitting around somewhere.
>
> Cheers,
>
> David
Thank you for the suggestion. Though I must admit, I'm unsure how
having GIF files will help with learning about IDLffVideoWrite; doesn't
the IDLffVideoWrite object deal directly with movie files (AVI, MP4)
rather than GIF files?
It seems the conceptual hurdle I am having a hard time getting over is
not the actual use of IDLffVideoWrite itself, but how to get my data in
the form that feeding it to IDLffVideoWrite::Put will give me a video
that appears how I want it.
My data is a sequence of 2D floating point arrays; I am using the
function graphics (am I supposed to call them "new" graphics?) to
byte-scale the data to a color table, warp it to a map projection, draw
continents, map grids, and color bar, etc. Is the trick simply to
follow the equivalent steps from
http://www.idlcoyote.com/gallery/avi_movie.pro where each frame is
created (with map grid, continents, etc.), saved to a file, then read
back in from the file to be loaded into the video stream?
Thanks!
|
|
|
Re: animated gif speed [message #87586 is a reply to message #87585] |
Sat, 15 February 2014 16:23   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul Levine writes:
>
> Thank you for the suggestion. Though I must admit, I'm unsure how
> having GIF files will help with learning about IDLffVideoWrite; doesn't
> the IDLffVideoWrite object deal directly with movie files (AVI, MP4)
> rather than GIF files?
>
> It seems the conceptual hurdle I am having a hard time getting over is
> not the actual use of IDLffVideoWrite itself, but how to get my data in
> the form that feeding it to IDLffVideoWrite::Put will give me a video
> that appears how I want it.
>
> My data is a sequence of 2D floating point arrays; I am using the
> function graphics (am I supposed to call them "new" graphics?) to
> byte-scale the data to a color table, warp it to a map projection, draw
> continents, map grids, and color bar, etc. Is the trick simply to
> follow the equivalent steps from
> http://www.idlcoyote.com/gallery/avi_movie.pro where each frame is
> created (with map grid, continents, etc.), saved to a file, then read
> back in from the file to be loaded into the video stream?
This is probably too much work. Why not just do it like in the example
in the IDLffVideoWrite documentation and take a snapshot of your display
window. Do your thing in the display window, take a snapshot, and
display that in your video stream. My example writes files because
that's the only way I can get great looking fonts. You won't have that
problem. (Although you could have others, I suppose, depending upon
which version of IDL you are using.)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
|
Re: animated gif speed [message #87605 is a reply to message #87583] |
Mon, 17 February 2014 14:36   |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
Paul Levine wrote, On 2014-02-15, 3:41pm:
> So far, when it comes to animations, my needs have been very simple, and I have
> been able to accomplish what I want (using new graphics) with the /APPEND
> keyword to the write method and the GIF file suffix, which gives me a nice
> little animated gif.
>
> Now I would like to be able to control the "playback speed" of the animated gif,
> which if I understand correctly, is basically a delay (in 1/100th of a second)
> specified for each frame that it waits before advancing to the subsequent frame.
> But it seems my rather simple method is too limited for this, as there is no
> DELAY_TIME keyword in new graphics as there is in the WRITE_GIF procedure.
(I'll guess you meant the Save method, not Write :-)
If you really need a GIF, and really need the DELAY_TIME (which Graphic.Save
doesn't support), then instead of using:
myGraphic.Save('myfile.gif', /APPEND)
... I'd suggest you copy the image data and use WRITE_GIF with DELAY_TIME. For
the GIF, you'll need to quantize colours down to 256 (which Graphic.Save seems
to do automatically).
imageRGB = myGraphic.CopyWindow()
image8bit = Color_Quan(imageRGB, 1, r, g, b, Colors=256)
Write_GIF, 'file.gif', image8bit, r, g, b, /Multiple, Delay_Time=myDelay
I did just this kind of thing (using XObjView instead of IDL 8 Graphics) for the
animated logo on my web pages. The Write_GIF business is at the bottom of this
source file:
http://www.d-jackson.com/images/djsclogo.pro
A Feature Request to Exelis to add DELAY_TIME (or GIF_DELAY_TIME, perhaps) to
Graphic.Save might bear fruit. It seems to me a small request.
Hope this helps!
Cheers,
-Dick
Dick Jackson Software Consulting Inc.
Victoria, BC, Canada
www.d-jackson.com
|
|
|
Re: animated gif speed [message #87618 is a reply to message #87605] |
Tue, 18 February 2014 16:17   |
Paul Levine
Messages: 29 Registered: February 2008
|
Junior Member |
|
|
On 2014-02-17 22:36:46 +0000, Dick Jackson said:
> Paul Levine wrote, On 2014-02-15, 3:41pm:
>> So far, when it comes to animations, my needs have been very simple, and I have
>> been able to accomplish what I want (using new graphics) with the /APPEND
>> keyword to the write method and the GIF file suffix, which gives me a nice
>> little animated gif.
>>
>> Now I would like to be able to control the "playback speed" of the
>> animated gif,
>> which if I understand correctly, is basically a delay (in 1/100th of a second)
>> specified for each frame that it waits before advancing to the
>> subsequent frame.
>> But it seems my rather simple method is too limited for this, as there is no
>> DELAY_TIME keyword in new graphics as there is in the WRITE_GIF procedure.
>
> (I'll guess you meant the Save method, not Write :-)
>
> If you really need a GIF, and really need the DELAY_TIME (which
> Graphic.Save doesn't support), then instead of using:
>
> myGraphic.Save('myfile.gif', /APPEND)
>
> ... I'd suggest you copy the image data and use WRITE_GIF with
> DELAY_TIME. For the GIF, you'll need to quantize colours down to 256
> (which Graphic.Save seems to do automatically).
>
> imageRGB = myGraphic.CopyWindow()
> image8bit = Color_Quan(imageRGB, 1, r, g, b, Colors=256)
> Write_GIF, 'file.gif', image8bit, r, g, b, /Multiple, Delay_Time=myDelay
>
> I did just this kind of thing (using XObjView instead of IDL 8
> Graphics) for the animated logo on my web pages. The Write_GIF business
> is at the bottom of this source file:
>
> http://www.d-jackson.com/images/djsclogo.pro
>
> A Feature Request to Exelis to add DELAY_TIME (or GIF_DELAY_TIME,
> perhaps) to Graphic.Save might bear fruit. It seems to me a small
> request.
>
> Hope this helps!
>
> Cheers,
> -Dick
>
> Dick Jackson Software Consulting Inc.
> Victoria, BC, Canada
> www.d-jackson.com
Thank you, indeed, that does help
|
|
|
Re: animated gif speed [message #87628 is a reply to message #87589] |
Wed, 19 February 2014 13:32  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
On 02/16/14 04:55, Fabien wrote:
> On 16.02.2014 00:41, Paul Levine wrote:
>> animated GIF (or otherwise) with control over the playback speed
>
> You should check the "animate" tool in ImageMagick:
>
> http://www.imagemagick.com/www/animate.html
Yes.
Or, how I do it, using just regular old convert in imagemagick with the
"-delay value" argument for a list of generated png files (via FG save
method), e.g.
$ convert -delay 100 *.png my_animated.gif
Compare to no delay
$ convert *.png my_animated.gif
Much much easier than mucking about with actual animation stuff in IDL.
(IMO)
cheers,
paulv
|
|
|