Import std.image.gif
Gif
struct
Public Struct Gif
What reads and writes GIF images and animations, in its Static Methods.
Examples
Local image = Image(4, 4)
image.Fill(Color32.Lime)
Local back = Try Gif.Decode(Gif.Encode(image))
Expect(back.Width == 4 && back[3, 3] == Color32.Lime)-
@PanicsAtCaller Public Static Method Decode(data: UInt8[], limit: Int = MOST_PIXELS): Image Throws IOErrorstatic method #The first frame of the GIF in
data. Throws an IOError of INVALID_DATA when thedataisn't a GIF or is broken, and OTHER when the frame has more pixels thanlimit. Panics when thelimitis negative. -
@PanicsAtCaller Public Static Method DecodeAnimation(data: UInt8[], limit: Int = MOST_PIXELS): Animation Throws IOErrorstatic method #The frames of the GIF in
data, each as it's shown once the frames before it are, its delay in hundredths of a second as milliseconds, and how many times they play, by the NETSCAPE2.0 extension, which counts the times after the first, or once without it. Throws an IOError as Decode does, of OTHER when the frames, all their pixels counted, have more thanlimit. Panics when thelimitis negative. -
The GIF of the
image, one frame. Panics when it has no pixels or a side longer than 65535. -
The GIF of the
animation's frames, each delay in hundredths of a second, rounded, and each frame drawn on a transparent canvas. Panics when theanimationhas no frames, no pixels, a side longer than 65535, a frame whose image isn't its size, or one longer than 655350 milliseconds, or plays more than 65536 times, which GIF can't count.
Report an issue with this page or with FutureBlitz on GitHub.