Closed
Description
If I try to re-encode an image from JPEG to AVIF everything works as expected:
$image = \Jcupitt\Vips\Image::newFromFile('path/to/image.jpg');
$image->writeToFile('path/to/image.avif');
However if I try to write the AVIF image to a buffer I get an error:
$image = \Jcupitt\Vips\Image::newFromFile('path/to/image.jpg');
$buffer = $image->writeToBuffer('.avif');
libvips error: VipsForeignSave: ".avif" is not a known buffer format
The difference seems to be in the vips_foreign_find
methods:
FFI::vips()->vips_foreign_find_save('.avif'); // "VipsForeignSaveHeifFile"
FFI::vips()->vips_foreign_find_save_buffer('.avif'); // null
I can get it to do it if I use the following workaround:
$image = \Jcupitt\Vips\Image::newFromFile('path/to/image.jpg');
$buffer = $image->writeToBuffer('.heif', ['compression' => 'av1'])
Am I doing something wrong or is this expected behaviour?
Metadata
Metadata
Assignees
Labels
No labels