gif = GD::Gif.new("output.gif", loop: true)
Creates a new animated GIF writer.
GD::Gif.new initializes a GIF encoder used to generate animated GIFs.
At this stage, the output file is created, but no image data is written until frames are added.
path (String)The file path where the GIF will be written.
GD::Gif.new("animation.gif")
loop (Boolean, optional)Controls how the animation loops.
true (default)
The animation loops infinitely.
false
The animation plays once and stops.
GD::Gif.new("once.gif", loop: false)
add_frame callclose to properly finalize the GIFclose may result in a corrupted file