Features:
- Added
Frame::from_grayscale_with_alphato efficiently generate a palette forLumaApixels. - Added
Decoder::current_frame_infoto re-query thenext_frame_infowithout advancing the frame.
Enhancements:
- The palette for
Frame::from_rgba_speednow handles multiple transparent colors, i.e. non-premultiplied alpha, by normalizing fully transparent pixels to one transparent entry. This leads to a better distributed palette.
EncodingErrorandDecodingErrorare now#[non_exhaustive]- Modified several error paths to return a new variant of
EncodingErrorinstead of boxing them into anio::Error, several returnResulttypes are adjusted accordingly. - The
Decodedenum no longer communicates data from decoded sub-blocks such as the repetition count. It now only contains the meta information on framing and extension data. This ensures we are yielding less often for performance. last_extwas renamed tolast_extension_sub_blockfor clarity.- The
Decoderwill now collect XMP and ICC metadata subblocks, making them available after decoding.
- Fix interpretation of LZW stream when multiple intermediate reset codes are used.
- Allow extension blocks of unknown type with the
allow_unknown_blocksoption.
- Simplified internal decoder size
Bugfixes:
- Fixed writing palettes with non-power-of-two sizes
Features:
- Added
Iteratorinterface for theDecoder - Added reading number of loop repetitions
Decoder::repeat. - Added
skip_frame_decodingoption to readFrame.bufferas LZW data. It works together withwrite_lzw_pre_encoded_framefor quick rewriting of GIF files. - Added support pre-allocated
Vecs infrom_palette_pixels - Added ability to recover the
io::Reader after decoding. - Added support for decompressing
Frame.bufferwith LZW data, which enables fully parallel GIF re-encoding (see examples/parallel.rs),
Optimization:
- Less buffering, copying, and lower peak memory usage.
Other changes:
- Removed
unsafe {}code. - Enforced memory limit also on metadata extension blocks, and added out-of-memory checks where possible.
EncodingFormatErrorenum is public.- Removed defunct
skip_extensions - Added validation of frame dimensions. The buffer must be large enough for all pixels, and if the width or height is 0, the buffer must be empty.
Features:
- Add compression of pre-compressed frame data, via
Encoder::write_lzw_pre_encoded_frame. - The
color_quantdependency is now optional. Turning it off disables some interfaces that would internally build quantization tables. The generic implementation of creating such tables can be prohibitively costly compared to specialized algorithms in some use cases.
Optimization:
- Avoid some allocations in by replacing
flat_mapargument with arrays
Bufixes:
- Fix decoding confusing superfluous image data from previous frames with current frame data.
- Bump minimum required version of
weezl.
Features:
- Add
Encoder::{get_ref, get_mut, into_inner}to access underlying stream.
Bugfixes:
- Fix panic while decoding some images, has no precise cause in the file.
- Warn about
set_extensionsbeing unimplemented...
Features:
- Added
StreamingDecoder::versionto query the precise version of the standard used for encoding the file. This is merely a hint. - Added
DecodeOptions::allow_unknown_blocksto skip over unknown or unspecified block kinds.
Optimization:
Frame::from_rgbanow recognizes when less than 256 colors are being used, dynamically skipping the quantization phase.- Encoding image chunks is faster and simpler
- Fix panic when LZW code size is invalid
- Added option to omit check for lzw end code
- Frames out-of-bounds of the screen descriptor are again accepted by default.
- Added
DecodeOptions::check_frame_consistencyto turn this validation on.
- Rename
ReadertoDecoder. - Reworked
DecoderintoDecodeOptions. - The decoding error is now opaque and no longer allocates a string. Adding more information or more error conditions is forward compatible.
- Replace the lzw decoder with
weezl, up to +350% throughput. - The dysfunctional C-API has been (temporarily?) removed
- It may get reintroduced as a separate crate at some point
- Added a
stdfeature. It must be active for now.