uploadcare / pillow-simd

The friendly PIL fork
https://python-pillow.github.io/pillow-perf/
Other
2.12k stars 85 forks source link

Box Blur number of passes is not controllable from Python #89

Closed bmharper closed 3 years ago

bmharper commented 3 years ago

One of the great features of Pillow-SIMD is it's iterative box blur, but the number of passes cannot be controlled from Python.

Am I missing something here?

homm commented 3 years ago

There are no good reasons for complicating the API. If you need only one pass (Box blur), there is separate filter for this. If you need Gaussian Blur, 3 passes is quite good approximation and doesn’t became better with more passes.

If you want something really strange, you can use low-level api and call im.box_blur and im.gaussian_blur with second argument, which number of passes.

bmharper commented 3 years ago

Thanks - so just to make sure - does this code end up inside ImagingGaussianBlur with passes = 3?

im = im.filter(ImageFilter.GaussianBlur(radius))

I guess that's fine - 3 passes is OK.

homm commented 3 years ago

Right.