avifinfo.php

PHP implementation of avifinfo.c.
Add avifinfo_test.php.

Change-Id: I78327c42344cb8d9eb8bcff9c74d9f615140b111
3 files changed
tree: 316748ac9db913408a543851ddf2d40c7d6d2b4e
  1. tests/
  2. tools/
  3. avifinfo.c
  4. avifinfo.h
  5. avifinfo.php
  6. CMakeLists.txt
  7. LICENSE
  8. PATENTS
  9. README.md
README.md

AVIF-info

libavifinfo is a standalone library that can be used to extract the width, height, bit depth and number of channels from an AVIF payload.

See avifinfo.h for details on the API and avifinfo.c for the implementation. See avifinfo_test.cc for usage examples.

Contents

  1. How to use

    1. Build
    2. Test
  2. Development

    1. Coding style
    2. Submitting patches
  3. PHP implementation

  4. Bug reports

How to use

libavifinfo can be used when only a few AVIF features are needed and when linking to or including libavif is not an option. For decoding an image or extracting more features, please rely on libavif.

AvifInfoFeatures features;
if (AvifInfoGet(bytes, number_of_available_bytes, &features) == kAvifInfoOk) {
  // Use 'features.width' etc.
}

Note: AvifInfoGet() is designed to return the same avifImage field values as avifDecoderRead(). However libavifinfo is more permissive and may return features of images considered invalid by libavif.

Build

avifinfo.c is written in C. To build from this directory:

mkdir build && \
cd build && \
cmake .. && \
cmake --build . --config Release

Test

Tests are written in C++. GoogleTest is required.

mkdir build && \
cd build && \
cmake .. -DAVIFINFO_BUILD_TESTS=ON && \
cmake --build . --config Debug && \
ctest .

Development

Coding style

Google C/C++ Style Guide is used in this project.

Submitting patches

If you would like to contribute to libavifinfo, please follow the steps for libaom at https://aomedia.googlesource.com/aom/#submitting-patches.

PHP implementation

libavifinfo was implemented into php-src natively and is available through getimagesize() at head. If it is not available in the PHP release version you use, you can fallback to avifinfo.php instead.

See avifinfo_test.php for a usage example.

Bug reports

Bug reports can be filed in the Alliance for Open Media issue tracker.