Expand description
A codec for the SVGA animation format: decode, inspect and losslessly edit. It renders nothing and makes no optimization decisions.
There are two layers:
Documentis the lossless one. It keeps every top-level protobuf field as its original bytes, so unknown fields, field order and float bit patterns survive, and an unedited document re-encodes to the exact same payload. All edits happen here.Movieis a typed, read-only view decoded on demand from a document.
let document = svga::Document::from_bytes(&file)?;
for image in document.images() {
println!("{:?}: {} bytes", image.key(), image.value().len());
}
let smaller = document.replace_image("hat", b"hat.png")?;
let bytes = smaller.to_bytes(svga::Compression::Best)?;Re-exports§
pub use movie::Movie;
Modules§
- movie
- The typed view: a read-only picture of a movie, decoded on demand.
- wire
- Minimal protobuf wire walker and writer.
Structs§
- Animation
- A decoded animation of any supported flavour.
- Document
- An SVGA 2.x movie that can be edited and re-encoded without loss.
- Error
- The error type of this crate.
- Image
Entry - One entry of the
imagesmap as stored. - Limits
- Upper bounds enforced while reading. Every reader has a
_withvariant taking these; the plain variants useLimits::default.
Enums§
- Compression
- Effort spent compressing the output.
- Container
- How a file wraps its movie, judged from the leading bytes only.
- Error
Kind - What went wrong, at the level a caller usually branches on.
- Format
- How the movie is stored.
- Value
Kind - What an
imagesvalue looks like. Sniffed from the bytes; nothing is decoded.
Functions§
- is_
animated_ png - Whether a PNG declares animation.
acTLmust precedeIDAT, so the walk stops at the first image data. - png_
dimensions - Pixel width and height from a PNG’s header, without decoding anything.
Nonewhen the bytes are not a PNG with a leadingIHDRchunk.