php8.5
Home/ Manual/ image / functions/ imageavif

imageavif

PHP function Edit on GitHub ✎

(PHP 8 >= 8.1.0)

Output

Description

imageavif(GdImage $image, resource|string|null $file = null, int $quality = -1, int $speed = -1): bool

Outputs or saves a AVIF Raster image from the given image.

Parameters

file

Path

quality

quality is optional, and ranges from 0 (worst quality, smaller file) to 100 (best quality, larger file). If -1 is provided, the default value 52 is used.

speed

speed is optional, and ranges from 0 (slow, smaller file) to 10 (fast, larger file). If -1 is provided, the default value 6 is used.

Return Values

Success

Trueonerror

Errors/Exceptions

Throws a ValueError if quality or speed is invalid.

Changelog

VersionDescription
8.4.0Now throws a ValueError if quality or speed is invalid.

See Also

Source: reference/image/functions/imageavif.xml · from the official PHP manual (php/doc-en)