Multi-frame GIF (87a/89a) codec, delegating every byte of the GIF format to
the com.blockether/imaging native cdylib (Rust image crate): LZW, palette
quantization, interlace, disposal and NETSCAPE looping -- all of it lives there
now.
This used to be a hand-rolled pure-Clojure codec (its own LZW decode/encode,
sub-block framing, disposal compositor, median-cut-free palette path). That
could not survive the image crate's decode-limit changes and duplicated work
the cdylib already does; the native path composites every frame onto a
full-size canvas honouring GIF disposal (the image crate's own
GifFrameIterator), so a caller only ever sees plain packed-0xAARRGGBB
pixels -- exactly the shape the old decode produced.
Multi-frame GIF (87a/89a) codec, delegating every byte of the GIF format to the `com.blockether/imaging` native cdylib (Rust `image` crate): LZW, palette quantization, interlace, disposal and NETSCAPE looping -- all of it lives there now. This used to be a hand-rolled pure-Clojure codec (its own LZW decode/encode, sub-block framing, disposal compositor, median-cut-free palette path). That could not survive the `image` crate's decode-limit changes and duplicated work the cdylib already does; the native path composites every frame onto a full-size canvas honouring GIF disposal (the `image` crate's own `GifFrameIterator`), so a caller only ever sees plain packed-0xAARRGGBB pixels -- exactly the shape the old [[decode]] produced.
(decode data)Decode every frame of data via the native imaging cdylib.
Returns {:width :height :loop-count :frames [{:delay-ms :disposal :argb}]}
where :argb is a full-canvas int[] of packed 0xAARRGGBB pixels (the cdylib
composites each frame honoring GIF disposal, so every frame is directly
displayable), or nil when data is not a GIF. :loop-count is -1 for loop
forever, otherwise the iteration count.
Decode every frame of `data` via the native `imaging` cdylib.
Returns `{:width :height :loop-count :frames [{:delay-ms :disposal :argb}]}`
where `:argb` is a full-canvas int[] of packed 0xAARRGGBB pixels (the cdylib
composites each frame honoring GIF disposal, so every frame is directly
displayable), or nil when `data` is not a GIF. `:loop-count` is -1 for loop
forever, otherwise the iteration count.(encode spec)Encode frames into one GIF89a byte array via the native imaging cdylib.
{:width :height :loop-count :frames}, every frame {:delay-ms :rgba} where
:rgba is straight RGBA8 (widthheight4 bytes). :loop-count nil or 0 means
loop forever (the GIF/PIL convention); an explicit count plays that many times.
The cdylib owns palette quantization, LZW, disposal and the NETSCAPE loop
block.
Encode `frames` into one GIF89a byte array via the native `imaging` cdylib.
`{:width :height :loop-count :frames}`, every frame `{:delay-ms :rgba}` where
`:rgba` is straight RGBA8 (width*height*4 bytes). `:loop-count` nil or 0 means
loop forever (the GIF/PIL convention); an explicit count plays that many times.
The cdylib owns palette quantization, LZW, disposal and the NETSCAPE loop
block.(gif? data)True when data starts with a GIF87a/GIF89a signature.
True when `data` starts with a GIF87a/GIF89a signature.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |