Crate imagequant_sys [−] [src]
Small, portable C library for high-quality conversion of RGBA images to 8-bit indexed-color (palette) images. It's powering pngquant2.
This is a low-level crate exposing a C API. If you're looking for a Rust library, see imagequant.
License
Libimagequant is dual-licensed:
For Free/Libre Open Source Software it's available under GPL v3 or later with additional copyright notices for older parts of the code.
For use in non-GPL software (e.g. closed-source or App Store distribution) please ask kornel@pngquant.org for a commercial license.
Overview
The basic flow is:
- Create attributes object and configure the library.
- Create image object from RGBA pixels or data source.
- Perform quantization (generate palette).
- Store remapped image and final palette.
- Free memory.
Please note that libimagequant only handles raw uncompressed arrays of pixels in memory and is completely independent of any file format.
There are 3 ways to create image object for quantization:
liq_image_create_rgba()
for simple, contiguous RGBA pixel arrays (width×height×4 bytes large bitmap).liq_image_create_rgba_rows()
for non-contiguous RGBA pixel arrays (that have padding between rows or reverse order, e.g. BMP).liq_image_create_custom()
for RGB, ABGR, YUV and all other formats that can be converted on-the-fly to RGBA (you have to supply the conversion function).
Note that "image" here means raw uncompressed pixels. If you have a compressed image file, such as PNG, you must use another library (e.g. lodepng) to decode it first.
Structs
liq_histogram_entry | |
liq_palette |
Enums
liq_attr | |
liq_error | |
liq_histogram | |
liq_image | |
liq_ownership | |
liq_result |
Functions
Type Definitions
liq_color | |
liq_image_get_rgba_row_callback | |
liq_log_callback_function | |
liq_log_flush_callback_function | |
liq_progress_callback_function |