Open dreampiggy opened 1 year ago
As of now, there is no way to scale the image at the decoder level (i.e.) the whole image will always be decoded.
libavif has a function that you can use to scale the image after it is decoded. Please look into avifImageScale
. It is not part of the public API though.
If this solution is of interest to you, we can consider making the avifImageScale
function publicly available in avif.h
avifImageScale
is also used in Skia which uses internal.h
to do that, even though it's supposed to be internal...
It might be good to make the function public.
avifImageScale
is also used in Skia which usesinternal.h
to do that, even though it's supposed to be internal... It might be good to make the function public.
yeah the blame on that one is on me. when the skia wrapper was written, the scaling code was only available when libavif was built with libyuv. so we couldn't make that public as it would depend on libyuv existing (#937). so i went ahead and used the internal header in skia (since skia always builds libavif with libyuv).
but now we have scaling support natively in libavif without the need for libyuv ( thanks to #1534 ). so the libavif scale functions can be made public. i will revive #937 and update the skia code as well.
I search the header of avif.h and could not find anything related to this
Seems libwebp contains something like this:
Which allows easy to use when we want a thumbnail for huge image...Like my demo code
Which can return the smaller scaled
avifImage
and itsyuvPlanes
And also, seems the
avifDecoderSource.AVIF_DECODER_SOURCE_THUMBNAIL_ITEM
shows unimplemented 😂 Even if the AVIF contains embed thumbnail, I can not get that one for quickly display for thumbnail.My personal use case: Speed up the render of tons of AVIF thumbnails on macOS Finder using https://github.com/dreampiggy/AVIFQuickLook