Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

Do not use DEFAULT_MAX_THREADS when saving AVIF images

Open radarhere opened this issue 8 months ago • 0 comments

At the moment, DEFAULT_MAX_THREADS may be used when saving an AVIF image. https://github.com/python-pillow/Pillow/blob/58e48745cc7b6c6f7dd26a50fe68d1a82ea51562/src/PIL/AvifImagePlugin.py#L57-L59 https://github.com/python-pillow/Pillow/blob/58e48745cc7b6c6f7dd26a50fe68d1a82ea51562/src/PIL/AvifImagePlugin.py#L167

However, I don't think that's indicated by comments. https://github.com/python-pillow/Pillow/blob/58e48745cc7b6c6f7dd26a50fe68d1a82ea51562/src/PIL/AvifImagePlugin.py#L16-L20

And it's not mentioned in the docs - https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#avif

max_threads Limit the number of active threads used. By default, there is no limit. If the aom codec is used, there is a maximum of 64.

So this PR suggests not using it when saving. The user can specify it through im.save(max_threads=...).

cc @fdintino

radarhere avatar Apr 25 '25 07:04 radarhere