riff: A wrapper to the FLIF library.🔗ℹ 
riff is a simple wrapper to the FLIF library, providing a
mostly C-like interface.
 1 Common FLIF Functions🔗ℹ 
This ctype is the basis for the functions in this section. It is associated
with an image itself - either from file or its bytes.
Determines if the given file has a FLIF header.
(flif-create-image width height) → _FLIF-IMAGE 
  |  |   width : integer? |  |   height : integer? |  
  | 
(flif-create-image-rgb width height) → _FLIF-IMAGE 
  |  |   width : integer? |  |   height : integer? |  
  | 
(flif-create-image-gray width height) → _FLIF-IMAGE 
  |  |   width : integer? |  |   height : integer? |  
  | 
(flif-create-image-gray16 width height) → _FLIF-IMAGE 
  |  |   width : integer? |  |   height : integer? |  
  | 
(flif-create-image-palette width height) → _FLIF-IMAGE 
  |  |   width : integer? |  |   height : integer? |  
  | 
(flif-create-image-hdr width height) → _FLIF-IMAGE 
  |  |   width : integer? |  |   height : integer? |  
  | 
Creates a pointer to a _FLIF-IMAGE struct. Note:
flif-create-image is RGBA.
Creates a pointer to a _FLIF-IMAGE struct by importing the associated bytes.
(flif-destroy-image! image) → void? 
  | 
|   image : _FLIF-IMAGE | 
Destroy the image pointer.
(flif-image-get-width image) → integer? 
  |  |   image : _FLIF-IMAGE |  
  | 
(flif-image-get-height image) → integer? 
  |  |   image : _FLIF-IMAGE |  
  | 
(flif-image-get-nb-channels image) → integer? 
  |  |   image : _FLIF-IMAGE |  
  | 
Gets the associated information from the image pointer.
(flif-image-get-palette-size image) → integer? 
  | 
|   image : _FLIF-IMAGE | 
Gets the size of the palette from the image pointer, where 0
means no palette and 1 - 256 means nb of colors in
the palette.
(flif-image-get-palette image) → bytes? 
  | 
|   image : _FLIF-IMAGE | 
Gets the bytes of the image palette from a newly-created byte buffer,
allocated with flif-image-get-palette-size.
(flif-image-set-palette! image buffer) → void? 
  | 
|   image : _FLIF-IMAGE | 
|   buffer : bytes? | 
Puts the RGBA bytes into the image pointer (must be
(* 4 palette-size) in size).
(flif-image-get-depth image) → integer? 
  | 
|   image : _FLIF-IMAGE | 
Gets the bit-depth of the image (e.g. 8).
(flif-image-get-frame-delay image) → integer? 
  |  |   image : _FLIF-IMAGE |  
  | 
| (flif-image-set-frame-delay! |   | image |   |   |   |   |  |   |   | frame-delay) |   | → |   | void? |  
 
  |  |   image : _FLIF-IMAGE |  |   frame-delay : integer? |  
  | 
Gets or sets the frame delay for an image. Only applicable for FLIF images with animation.
(flif-image-get-metadata image chunkname) → bytes? 
  | 
|   image : _FLIF-IMAGE | 
|   chunkname : string? | 
Gets the metadata from the image from a newly-created pointer that is passed
to the FFI.
| (flif-image-set-metadata! |   | image |   |   |   |   |  |   |   | chunkname |   |   |   |   |  |   |   | data) |   | → |   | void? |  
 
  | 
|   image : _FLIF-IMAGE | 
|   chunkname : string? | 
|   data : bytes? | 
Sets the metadata for the image.
(flif-image-free-metadata! image data) → void? 
  | 
|   image : _FLIF-IMAGE | 
|   data : cpointer? | 
Free the data pointer returned by flif-image-get-metadata –
this function is largely worthless because there is no pointer to free and it
is visible to the garbage collector anyway. However, just for gits and
shiggles, I added this function to the end of flif-image-get-metadata
to free the generated data pointer.
| (flif-image-write-row-palette8! |   | image |   |   |   |   |  |   |   | row |   |   |   |   |  |   |   | buffer) |   | → |   | void? |  
 
  |  |   image : _FLIF-IMAGE |  |   row : integer? |  |   buffer : bytes? |  
  | 
 | 
 | 
| (flif-image-write-row-gray8! |   | image |   |   |   |   |  |   |   | row |   |   |   |   |  |   |   | buffer) |   | → |   | void? |  
 
  |  |   image : _FLIF-IMAGE |  |   row : integer? |  |   buffer : bytes? |  
  | 
 | 
 | 
| (flif-image-write-row-rgba8! |   | image |   |   |   |   |  |   |   | row |   |   |   |   |  |   |   | buffer) |   | → |   | void? |  
 
  |  |   image : _FLIF-IMAGE |  |   row : integer? |  |   buffer : bytes? |  
  | 
 | 
 | 
Read or write 8-bit depth image data. read-row-type functions will
return a byte string of length len with the row pixels inside, while
read-type functions will reaturn a byte string width x
height in size.
Read or write 16-bit depth image data. read-row-type functions will
return a byte string of length len with the row pixels inside, while
read-type functions will reaturn a byte string width x
height in size.
Free the memory located inside the buffer gcpointer. Again, this is kind of
a useless function.
2 Decoder Functions🔗ℹ 
The generalized form of the progressive callback function.
These ctypes are the basis for the functions in this section. They keep track
of the image you are working on.
(flif-animated? img) → boolean? 
  | 
|   img : flif? | 
Determine if the FLIF image provided is animated.
(flif-create-decoder) → _FLIF-DECODER 
  | 
Create a new pointer to a _FLIF-DECODER struct.
(flif-decoder-decode-file! decoder file) → boolean? 
  |  |   decoder : _FLIF-DECODER |  |   file : string? |  
  | 
| (flif-decoder-decode-memory! |   | decoder |   |   |   |   |  |   |   | buffer) |   | → |   | boolean? |  
 
  |  |   decoder : _FLIF-DECODER |  |   buffer : bytes? |  
  | 
| (flif-decoder-decode-filepointer! |   | decoder |   |   |   |   |  |   |   | filepointer |   |   |   |   |  |   |   | filename) |   | → |   | boolean? |  
 
  |  |   decoder : _FLIF-DECODER |  |   filepointer : cpointer? |  |   filename : string? |  
  | 
Decode the FLIF either from a string to the file, from its bytes,
or from a filepointer.
(flif-decoder-num-images decoder) → integer? 
  | 
|   decoder : _FLIF-DECODER | 
Obtain the number of frames in the FLIF.
(flif-decoder-num-loops decoder) → integer? 
  | 
|   decoder : _FLIF-DECODER | 
The number of times the FLIF animation should be looped (0 indicates
the FLIF should be looped forever).
(flif-decoder-get-image decoder index) → _FLIF-IMAGE 
  | 
|   decoder : _FLIF-DECODER | 
|   index : integer? | 
Obtain the _FLIF-IMAGE pointer to the frame located at index.
Generate a preview to display.
(flif-destroy-decoder! decoder) → void? 
  | 
|   decoder : _FLIF-DECODER | 
Free memory associated with the pointer.
(flif-abort-decoder! decoder) → void? 
  | 
|   decoder : _FLIF-DECODER | 
Abort the decoder (may be used before decoding is complete).
| (flif-decoder-set-crc-check! |   | decoder |   |   |   |   |  |   |   | check?) |   | → |   | void? |  
 
  | 
|   decoder : _FLIF-DECODER | 
|   check? : boolean? | 
Set whether the decoder should check the CRC. The default behavior is to not
check the CRC.
(flif-decoder-set-quality! decoder quality) → void? 
  | 
|   decoder : _FLIF-DECODER | 
|   quality : (integer-in 0 100) | 
Set the decoder quality.
(flif-decoder-set-scale! decoder scale) → void? 
  | 
|   decoder : _FLIF-DECODER | 
|   scale : integer? | 
Set the decoder scale. scale must be a number that is a power of 2:
1, 2, 4, 8, 16 ...
(flif-decoder-set-resize! decoder resize) → void? 
  | 
|   decoder : _FLIF-DECODER | 
|   resize : integer? | 
Set the decoder resize.
(flif-decoder-set-fit! decoder fit) → void? 
  | 
|   decoder : _FLIF-DECODER | 
|   fit : integer? | 
Set the decoder fit.
| (flif-decoder-set-callback! |   | decoder |   |   |   |   |  |   |   | callback |   |   |   |   |  |   |   | user-data) |   | → |   | void? |  
 
  | 
|   decoder : _FLIF-DECODER | 
|   callback : _callback-t | 
|   user-data : ctype? | 
Set the decoder callback. Useful for progressive decoding where the callback
is called at every new level of quality achieved.
| (flif-decoder-set-first-callback-quality! |   | decoder |   |   |   |   |  |   |   | quality) |   | → |   | void? |  
 
  | 
|   decoder : _FLIF-DECODER | 
|   quality : integer? | 
Set the first quality level to send to the decoder callback. Note: setting
decoder quality is different from setting the initial callback quality.
(flif-read-info-from-memory buffer) → _FLIF-INFO 
  | 
|   buffer : bytes? | 
Generate an info pointer with information gained from buffer.
(flif-destroy-info! info) → void? 
  | 
|   info : _FLIF-INFO | 
Destroy the info pointer.
(flif-dimensions img) → list? 
  | 
|   img : flif? | 
Read width and height information from img. This procedure is
provided because the flif-info C functions can be finicky and may report
incorrect values if the image has not yet been decoded.
(flif-info-get-width info) → integer? 
  |  |   info : _FLIF-INFO |  
  | 
(flif-info-get-height info) → integer? 
  |  |   info : _FLIF-INFO |  
  | 
(flif-info-get-nb-channels info) → integer? 
  |  |   info : _FLIF-INFO |  
  | 
(flif-info-get-depth info) → integer? 
  |  |   info : _FLIF-INFO |  
  | 
(flif-info-num-images info) → integer? 
  |  |   info : _FLIF-INFO |  
  | 
Obtain various data from the info pointer.
3 Encoder Functions🔗ℹ 
This ctype is the basis for the functions in this section. It is associated
with an image itself - either from file or its bytes.
(flif-create-encoder) → _FLIF-ENCODER 
  | 
Create a pointer to an encoder struct.
(flif-encoder-add-image! encoder image) → void? 
  | 
|   encoder : _FLIF-ENCODER | 
|   image : _FLIF-IMAGE | 
Add the image onto the encoder — add more than one image to create
an animation. This function will clone the image (so the input image is not
touched and you have to flif-destroy-image! on it yourself to free the memory).
| (flif-encoder-add-image-move! |   | encoder |   |   |   |   |  |   |   | image) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   image : _FLIF-IMAGE | 
Add the image onto the encoder — add more than one image to create
an animation. This function will move the image (input image
becomes invalid during encode and flif-destroy-encoder! will free it.
| (flif-encoder-encode-file! |   | encoder |   |   |   |   |  |   |   | filename) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   filename : string? | 
Encode to the supplied filename.
(flif-encoder-encode-memory encoder) → bytes? 
  | 
|   encoder : _FLIF-ENCODER | 
Encode to a newly-generated byte string. If the encoding fails, it will
raise-result-error.
(flif-destroy-encoder! encoder) → void? 
  | 
|   encoder : _FLIF-ENCODER | 
Destroy the encoder pointer.
| (flif-encoder-set-interlaced! |   | encoder |   |   |   |   |  |   |   | interlaced?) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   interlaced? : boolean? | 
Set whether the image is interlaced or non-interlaced (default is #t).
| (flif-encoder-set-learn-repeat! |   | encoder |   |   |   |   |  |   |   | learn) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   learn : integer? | 
Set how many times FLIF should learn the MANIAC tree (default is 2).
| (flif-encoder-set-auto-color-buckets! |   | encoder |   |   |   |   |  |   |   | acb?) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   acb? : boolean? | 
Default is #t.
| (flif-encoder-set-palette-size! |   | encoder |   |   |   |   |  |   |   | size) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   size : integer? | 
Default is 512, the max.
| (flif-encoder-set-lookback! |   | encoder |   |   |   |   |  |   |   | looback?) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   looback? : boolean? | 
Default is #t.
(flif-encoder-set-divisor! encoder divisor) → void? 
  | 
|   encoder : _FLIF-ENCODER | 
|   divisor : integer? | 
Default is 30.
(flif-encoder-set-min-size! encoder size) → void? 
  | 
|   encoder : _FLIF-ENCODER | 
|   size : integer? | 
Default is 50.
| (flif-encoder-set-split-threshold! |   | encoder |   |   |   |   |  |   |   | split) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   split : integer? | 
Default is 64.
| (flif-encoder-set-alpha-zero-lossless! |   | encoder |   |   |   |   |  |   |   | azl) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   azl : boolean? | 
Default is #f.
| (flif-encoder-set-chance-cutoff! |   | encoder |   |   |   |   |  |   |   | cutoff) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   cutoff : integer? | 
Default is 2.
| (flif-encoder-set-chance-alpha! |   | encoder |   |   |   |   |  |   |   | alpha) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   alpha : integer? | 
Default is 19.
| (flif-encoder-set-crc-check! |   | encoder |   |   |   |   |  |   |   | check?) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   check? : boolean? | 
Set whether or not a CRC check should be added.
| (flif-encoder-set-channel-compact! |   | encoder |   |   |   |   |  |   |   | plc?) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   plc? : boolean? | 
Default is #t.
(flif-encoder-set-ycocg! encoder ycocg?) → void? 
  | 
|   encoder : _FLIF-ENCODER | 
|   ycocg? : boolean? | 
Default is #t.
| (flif-encoder-set-frame-shape! |   | encoder |   |   |   |   |  |   |   | shape?) |   | → |   | void? |  
 
  | 
|   encoder : _FLIF-ENCODER | 
|   shape? : boolean? | 
Default is #t.
(flif-encoder-set-lossy! encoder loss) → void? 
  | 
|   encoder : _FLIF-ENCODER | 
|   loss : integer? | 
Set the amount of quality loss: 0 means no loss and 100 means
maximum loss. Negative values indicate adaptive lossy (second image should be
the saliency map). Default is 0.