imcodec library

Focused raster image encoding and decoding for Flutter.

Classes

BmpCodec
Encodes and decodes Bitmap images.
BmpDecodeOptions
Allows to pass options to a BmpDecoder.
BmpDecoder
Decodes uncompressed, bitfield, and run-length encoded BMP images.
BmpEncodeOptions
Allows to pass options to a BmpEncoder.
BmpEncoder
Encodes RGBA pixels as a 32-bit BMP with explicit color masks.
DecodedImage
Stores straight-alpha process samples without reducing their precision.
DecodedImageMetadata
Describes metadata that affects faithful raster decoding.
GifCodec
Encodes and decodes the first image in Graphics Interchange Format data.
GifDecodeOptions
Options for GIF decoding.
GifDecoder
Decodes the first visible GIF frame to straight RGBA pixels.
GifEncodeOptions
Options for GIF encoding.
GifEncoder
Encodes a single image as GIF89a data.
Image
Stores an 8-bit image in straight-alpha RGBA order.
ImageCodecExtension<EncodeOptions extends RasterEncodeOptions, DecodeOptions extends RasterDecodeOptions>
Supplies an optional codec implementation without adding a package dependency.
ImageCodecRegistry
Isolate-local registry of explicitly installed optional codecs.
ImageFormat
A named image format with its own file-signature matcher.
ImageFormatRegistry
Isolate-local ordered collection of formats recognized by Imcodec.
JpegCodec
Encodes and decodes Joint Photographic Experts Group images.
JpegDecodeOptions
Options for JPEG decoding.
JpegDecoder
Decodes baseline, extended sequential, and progressive Huffman JPEG data.
JpegEncodeOptions
Options for JPEG encoding.
JpegEncoder
Encodes images as baseline JPEG data.
JpegXlCodec
Encodes and decodes JPEG XL images.
JpegXlDecodeOptions
The JPEG XL decode options.
JpegXlDecoder
Decodes JPEG XL images to straight-alpha RGBA pixels.
JpegXlEncodeOptions
Lossy JPEG XL encoder options.
JpegXlEncoder
Encodes straight-alpha RGBA images as lossless JPEG XL Modular data.
OpenExrCodec
Encodes and decodes ordinary single-part OpenEXR scan-line images.
OpenExrDecodeOptions
The OpenEXT decoder options.
OpenExrDecoder
Decodes RGB, RGBA, or luminance OpenEXR scan-line parts.
OpenExrEncodeOptions
The OpenEXR encode options.
OpenExrEncoder
Encodes straight RGBA samples as scene-linear half-float OpenEXR.
ParallelRasterCodecExtension<EncodeOptions extends RasterEncodeOptions, Encoder extends ParallelRasterEncoder<EncodeOptions>, DecodeOptions extends RasterDecodeOptions, Decoder extends RasterDecoder<DecodeOptions>, Codec extends ParallelRasterCodec<EncodeOptions, Encoder, DecodeOptions, Decoder>>
A codec extension for a ParallelRasterCodec.
PngCodec
Encodes and decodes Portable Network Graphics images.
PngDecodeOptions
Options for the PNG decoder.
PngDecoder
Decodes standard and Adam7-interlaced PNG pixels synchronously.
PngEncodeOptions
Options for the PNG encoder.
PngEncoder
Encodes images as Portable Network Graphics data.
QoiCodec
Encodes and decodes Quite OK Image data.
QoiDecodeOptions
Options for the QOI decoder.
QoiDecoder
Decodes Quite OK Image data to RGBA pixels.
QoiEncodeOptions
Options for the QOI encoder.
QoiEncoder
Encodes RGBA pixels using the Quite OK Image specification.
RasterCodec<EncodeOptions extends RasterEncodeOptions, Encoder extends RasterEncoder<EncodeOptions>, DecodeOptions extends RasterDecodeOptions, Decoder extends RasterDecoder<DecodeOptions>>
Provides shared validation and error handling for synchronous image codecs.
RasterCodecExtension<EncodeOptions extends RasterEncodeOptions, Encoder extends RasterEncoder<EncodeOptions>, DecodeOptions extends RasterDecodeOptions, Decoder extends RasterDecoder<DecodeOptions>, Codec extends RasterCodec<EncodeOptions, Encoder, DecodeOptions, Decoder>>
A codec extension for a RasterCodec.
RasterDecodeOptions
Allows to pass options to a RasterDecoder.
RasterDecoder<Options extends RasterDecodeOptions>
Converts encoded raster bytes to an Image.
RasterEncodeOptions
Allows to pass options to a RasterEncoder.
RasterEncoder<Options extends RasterEncodeOptions>
Converts an Image to encoded raster bytes.
TgaCodec
Encodes and decodes Truevision TGA images.
TgaDecodeOptions
Options for the TGA decoder.
TgaDecoder
Decodes color-mapped, true-color, and grayscale TGA images.
TgaEncodeOptions
Options for the TGA encoder.
TgaEncoder
Encodes RGBA pixels as 32-bit true-color TGA data.
TiffCodec
Encodes and decodes Tagged Image File Format images.
TiffDecodeOptions
Options for the TIFF decoder.
TiffDecoder
Decodes baseline TIFF images to straight RGBA pixels.
TiffEncodeOptions
Options for the TIFF encoder.
TiffEncoder
Encodes straight RGBA pixels as baseline TIFF data.
WebPCodec
Encodes and decodes WebP images. Encoding produces lossless VP8L or lossy VP8 data. Decoding accepts lossless VP8L, lossy VP8, alpha data, and the first frame of animated WebP files.
WebPDecodeOptions
The WebP decode options.
WebPDecoder
Decodes static and first-frame WebP images synchronously.
WebPEncodeOptions
The options for encoding a WebP image.
WebPEncoder
Encodes images as lossless VP8L or lossy VP8 WebP data.

Enums

ChannelOrder
Describes the channel layout of source pixel bytes.
DecodedColorModel
Identifies the process channels retained by a decoded raster.
DecodedSampleFormat
Identifies the scalar representation of decoded channel samples.
JpegChroma
Selects the chroma sampling used by the JPEG encoder.
JpegXlEffort
Trade-off between JPEG XL encoding speed and output size.
OpenExrCompression
Compression methods emitted by OpenExrEncoder.
TiffCompression
Compression methods available when encoding TIFF images.
WebPEffort
Trade-off between lossy WebP encoding speed and output quality.

Mixins

InspectableFormat
An inspectable ImageFormat.
ParallelImageCodecExtension<EncodeOptions extends RasterEncodeOptions, DecodeOptions extends RasterDecodeOptions>
A codec extension that offers independent encoding work.
ParallelRasterCodec<EncodeOptions extends RasterEncodeOptions, Encoder extends ParallelRasterEncoder<EncodeOptions>, DecodeOptions extends RasterDecodeOptions, Decoder extends RasterDecoder<DecodeOptions>>
A codec that can spread work across isolates.
ParallelRasterEncoder<Options extends RasterEncodeOptions>
An encoder that can spread work across isolates.

Constants

defaultMaxDecodedBytes → const int
Default maximum number of sample bytes one decoded raster may hold.
defaultMaxDescriptiveMetadataBytes → const int
Default maximum size of each retained EXIF, IPTC, or XMP packet.
defaultMaxIccProfileBytes → const int
Default maximum number of decompressed ICC bytes retained from a container.

Functions

decodeBmp(Uint8List bytes, {BmpDecodeOptions? options}) Image
Decodes an uncompressed or bitfield BMP image to straight RGBA.
decodeGif(Uint8List bytes, {GifDecodeOptions? options}) Image
Decodes the first visible GIF frame to straight RGBA.
decodeImage<Options extends RasterDecodeOptions>(Uint8List bytes, {Options? options}) Image
Decodes a supported image synchronously to straight RGBA.
decodeImageData<Options extends RasterDecodeOptions>(Uint8List bytes, {Options? options, int? maxPixels, int maxDecodedBytes = defaultMaxDecodedBytes, int maxIccProfileBytes = defaultMaxIccProfileBytes}) DecodedImage
Decodes native process samples and attaches supported container metadata.
decodeJpegXl(Uint8List bytes, {JpegXlDecodeOptions? options}) Image
Decodes the first visible frame of a JPEG XL image to straight RGBA.
decodeJpg(Uint8List bytes, {JpegDecodeOptions? options}) Image
Decodes a JPEG image to opaque RGBA.
decodeJpgData(Uint8List bytes, {JpegDecodeOptions? options, int maxDecodedBytes = defaultMaxDecodedBytes, int maxIccProfileBytes = defaultMaxIccProfileBytes}) DecodedImage
Decodes JPEG data while preserving native CMYK components when present.
decodeJxl(Uint8List bytes, {JpegXlDecodeOptions? options}) Image
Decodes the first visible frame of a JPEG XL image to straight RGBA.
decodeOpenExr(Uint8List bytes, {OpenExrDecodeOptions? options}) Image
Decodes one single-part OpenEXR scan-line image to straight RGBA8.
decodeOpenExrData(Uint8List bytes, {OpenExrDecodeOptions? options, int maxDecodedBytes = defaultMaxDecodedBytes}) DecodedImage
Decodes OpenEXR data while preserving floating-point HDR samples.
decodePng(Uint8List bytes, {PngDecodeOptions? options}) Image
Decodes the first frame of a PNG image to straight RGBA.
decodePngData(Uint8List bytes, {PngDecodeOptions? options, int maxDecodedBytes = defaultMaxDecodedBytes, int maxIccProfileBytes = defaultMaxIccProfileBytes}) DecodedImage
Decodes PNG data while preserving unsigned sixteen-bit samples.
decodeQoi(Uint8List bytes, {QoiDecodeOptions? options}) Image
Decodes a Quite OK Image to straight RGBA.
decodeTga(Uint8List bytes, {TgaDecodeOptions? options}) Image
Decodes an uncompressed or run-length encoded TGA image to straight RGBA.
decodeTiff(Uint8List bytes, {TiffDecodeOptions? options}) Image
Decodes the first image-file directory of a baseline TIFF image.
decodeTiffData(Uint8List bytes, {TiffDecodeOptions? options, int maxDecodedBytes = defaultMaxDecodedBytes, int maxIccProfileBytes = defaultMaxIccProfileBytes}) DecodedImage
Decodes TIFF data while preserving integer or floating-point samples.
decodeWebP(Uint8List bytes, {WebPDecodeOptions? options}) Image
Decodes the first frame of a WebP image to straight RGBA.
encodeBmp(Image image, {BmpEncodeOptions? options}) Uint8List
Encodes image as a 32-bit BMP with alpha bitfields.
encodeGif(Image image, {GifEncodeOptions? options}) Uint8List
Encodes image as one static palette-indexed GIF frame.
encodeImage<Options extends RasterEncodeOptions>(Image image, {required ImageFormat format, Options? options}) Uint8List
Encodes image to format with format-specific options.
encodeImageWith<Options extends RasterEncodeOptions>(ParallelRunner runner, Image image, {required ImageFormat format, Options? options}) Future<Uint8List>
Encodes image to format, offering runner independent work.
encodeJpeg(Image image, {JpegEncodeOptions? options}) Uint8List
Encodes image as a baseline JPEG.
encodeJpegWith(ParallelRunner runner, Image image, {JpegEncodeOptions? options}) Future<Uint8List>
Encodes image as a baseline JPEG through runner.
encodeJpegXl(Image image, {JpegXlEncodeOptions? options}) Uint8List
Encodes image as lossless JPEG XL Modular data.
encodeJpegXlWith(ParallelRunner runner, Image image, {JpegXlEncodeOptions? options}) Future<Uint8List>
Encodes image as lossless JPEG XL Modular data through runner.
encodeJpg(Image image, {JpegEncodeOptions? options}) Uint8List
Encodes image as a baseline JPEG.
encodeJpgWith(ParallelRunner runner, Image image, {JpegEncodeOptions? options}) Future<Uint8List>
Encodes image as a baseline JPEG through runner.
encodeJxl(Image image, {JpegXlEncodeOptions? options}) Uint8List
Encodes image as lossless JPEG XL Modular data.
encodeOpenExr(Image image, {OpenExrEncodeOptions? options}) Uint8List
Encodes image as a scene-linear half-float OpenEXR image.
encodeOpenExrFloat32Rgba({required int width, required int height, required Float32List pixels, OpenExrEncodeOptions? options}) Uint8List
Encodes straight extended-sRGB float samples as half-float OpenEXR.
encodePng(Image image, {PngEncodeOptions? options}) Uint8List
Encodes image as an 8-bit RGBA PNG.
encodePngWith(ParallelRunner runner, Image image, {PngEncodeOptions? options}) Future<Uint8List>
Encodes image as an 8-bit RGBA PNG through runner.
encodeQoi(Image image, {QoiEncodeOptions? options}) Uint8List
Encodes image as a lossless Quite OK Image.
encodeTga(Image image, {TgaEncodeOptions? options}) Uint8List
Encodes image as a 32-bit TGA image.
encodeTiff(Image image, {TiffEncodeOptions? options}) Uint8List
Encodes image as an eight-bit RGBA TIFF image.
encodeWebP(Image image, {WebPEncodeOptions? options}) Uint8List
Encodes image as lossless VP8L or lossy VP8 WebP data.
encodeWebPWith(ParallelRunner runner, Image image, {WebPEncodeOptions? options}) Future<Uint8List>
Encodes image as WebP through runner.
inspectImage(Uint8List bytes, {int maxIccProfileBytes = defaultMaxIccProfileBytes, int maxDescriptiveMetadataBytes = defaultMaxDescriptiveMetadataBytes}) DecodedImageMetadata?
Reads metadata needed to preserve authored samples and colour meaning.
onBoundedIsolates<T, R>(List<T> inputs, R task(T input), {int limit = 2}) Future<List<R>>
Runs jobs on isolates, never more than limit at a time.
onIsolates<T, R>(List<T> inputs, R task(T input)) Future<List<R>>
Runs one isolate per job, the shortest runner a caller can write.
runSequentially<T, R>(List<T> inputs, R task(T input)) Future<List<R>>
Runs every task on the current isolate, in order.

Typedefs

ParallelRunner = Future<List<R>> Function<T, R>(List<T> inputs, R task(T input))
Runs independent pieces of work, optionally on other isolates.

Exceptions / Errors

ImageCodecException
Reports invalid input or an unsupported codec operation.