#av1 #decoder #heif #image-conversion #libaom

bin+lib avif-decode

Convert AVIF images to PNG or decompressed pixel data

5 releases (2 stable)

1.0.1 Aug 2, 2024
1.0.0 Feb 11, 2024
0.2.2 Jan 31, 2022
0.2.1 Jul 14, 2021
0.2.0 Jan 12, 2021

#690 in Images

Download history 8/week @ 2024-07-22 183/week @ 2024-07-29 41/week @ 2024-08-05 55/week @ 2024-08-12 49/week @ 2024-08-19 60/week @ 2024-08-26 42/week @ 2024-09-02 31/week @ 2024-09-09 130/week @ 2024-09-16 179/week @ 2024-09-23 61/week @ 2024-09-30 129/week @ 2024-10-07 73/week @ 2024-10-14 110/week @ 2024-10-21 50/week @ 2024-10-28 73/week @ 2024-11-04

318 downloads per month
Used in 2 crates

BSD-3-Clause

21KB
365 lines

AVIF to PNG converter

Converts AVIF images (AV1 + HEIF) to standard PNG images. It's meant to decode very accurately (using AOM, precise colorspace conversions). It is not meant to produce small PNG files. Some PNG files will be 100 times larger than the AVIF input.

It can also be used as a Rust library for decoding straight to uncompressed pixels (RGBA, etc).

Usage

avif_decode input.avif output.png

It always processes one file at a time. If output path is omitted, it'll be the same as the input, except with a .png extension. Add -f to overwrite output files.

Install from source

Requires Rust 1.75 or later and a C compiler.

cargo install avif-decode

Features

Supported AVIF features

  • 8-, 10-, and 12-bit deep images. Images are saved as 16-bit PNG when necessary.
  • RGB and many flavors of YUV color spaces in both full and "studio" range.
  • Alpha channel, in both premultiplied and uncorrelated alpha modes.
  • 4:4:4, 4:2:2, 4:2:0 chroma modes. Chroma subsampling uses box upsampling. BTW: The AVIF spec intentionally left chroma upsampling algorithm unspecified, so images using 4:2:0 or 4:2:2 modes will have decoder-dependent distortions. It's best to never use chroma subsampling modes in AVIF.

Unsupported features

  • Any form of HDR. Maybe later.
  • YCgCo color space.
  • Embedded ICC color profiles. AV1 already supports so many color spaces, it'd be rude to support an extra color conversion layer that's complex and unecessary.
  • The kitchen sink of pointless HEIF features. I'm writing an image decoder, not Photoshop.

License

New BSD

Dependencies

~21MB
~424K SLoC