Open sandreas opened 2 years ago
Thank you for your questions.
- Why does
avifenc
does not support resize to save one encoding step?
avifenc
is not meant to be an extensive conversion tool. It is rather a simple utility to map the libavif API to command line options. See ImageMagick or ffmpeg for more powerful editing capabilities.
- What is the officially recommended process for creating
avif
thumbnails of larger images at the moment (jpg, lossless png or something else)?
A lossy format such as JPEG may bring visible compression artifacts, so lossless options are recommended. PNG is compressed so as you said it is suboptimal for a rescaling step. Uncompressed, lossless formats such as y4m (YUV) or pnm (RGB) would be a better fit.
For avifenc
use I would suggest either y4m, fastest max-quality JPEG settings, or fastest PNG settings.
- Would this be a good feature to have?
This feature might be available once https://github.com/AOMediaCodec/libavif/pull/761 has landed, since rescaling is a way to have progressive layers (besides lowering the quality). It depends on the final chosen public API and avifenc
integration though.
Thank you for your quick response.
See ImageMagick or ffmpeg for more powerful editing capabilities.
I did try ImageMagick but unfortunately I did not find a way to specify the following very specific options:
avifenc --min 0 --max 63 --yuv 420 -a end-usage=q -a cq-level=28 --ignore-icc -a tune=ssim --speed 0 {source} {destination}
The tune
and speed
would not be that important, but quality and size are very important in my case.
A lossy format such as JPEG may bring visible compression artifacts, so lossless options are recommended. PNG is compressed so as you said it is suboptimal for a rescaling step. Uncompressed, lossless formats such as y4m (YUV) or pnm (RGB) would be a better fit. For avifenc use I would suggest either y4m, fastest max-quality JPEG settings, or fastest PNG settings.
Thank you... I'll see what I can do.
This feature might be available once https://github.com/AOMediaCodec/libavif/pull/761 has landed, since rescaling is a way to have progressive layers (besides lowering the quality). It depends on the final chosen public API and avifenc integration though.
Ok, should I leave the ticket open as feature request? My questions are all answered...
I did try ImageMagick
I believe what Yannis means is that, you need to use ImageMagick to create an intermediate file and use avifenc to encode it into AVIF then.
I recommend using lossless format - in this case, PNG - for intermediate files. Artifacts introduced by JPEG may instead hurt your compression efficiency.
For ImageMagick you can use -define png:compression-level=0 -define png:compression-filter=0
options to effectively make the data uncompressed. Unfortunately avifenc does not accept PNG input from stdin, so you have to store the intermediate file somewhere. If you are on Linux, you can use /dev/shm
which stores files in memory and is fast.
@tongyuantongyu Thanks for your post...
For ImageMagick you can use -define png:compression-level=0 -define png:compression-filter=0 options to effectively make the data uncompressed. Unfortunately avifenc does not accept PNG input from stdin, so you have to store the intermediate file somewhere. If you are on Linux, you can use /dev/shm which stores files in memory and is fast.
Thats good to know. But lately I found libvips vipsthumbnail
(https://libvips.org) to be a pretty good alternative to ImageMagick (for me it was faster and more memory efficient). I'm currently experimenting with creating avif
directly out of vipsthumbnail
.
Hello,
I'm trying to use
avifenc
to create thumbnails from "out-of-camera" jpg files, these may be 6000x4000 in size and are high quality.Since
avifenc
cannot resize images, I first have to create a thumbnail in the correct size and a supported format (e.g. jpg or png) and then reencode this withavifenc
to have a validavif
file.Example: Lets say I would like to create a thumbnail of 235px in size. Now I have 2 possibilities:
jpg
to 235pxjpg
and thenavifenc
jpg
to 235pxpng
(lossless) and thenavifenc
While the lossless process file has better quality in the end, it is also significantly larger (which is logical), the whole process seems to be suboptimal.
So my questions:
avifenc
does not support resize to save one encoding step?avif
thumbnails of larger images at the moment (jpg, lossless png or something else)?Thank you.
sandreas