Support ImageFilter.BuiltinFilter for I;16* images#8438
Support ImageFilter.BuiltinFilter for I;16* images#8438radarhere merged 2 commits intopython-pillow:mainfrom
Conversation
| if mode[0] != "I" or ( | ||
| callable(filter_to_apply) | ||
| and issubclass(filter_to_apply, ImageFilter.BuiltinFilter) | ||
| ): |
There was a problem hiding this comment.
The isinstance condition, added in #7108, was never true - each BuiltinFilter run of this test uses a BuiltinFilter class, not an instance. So this corrects it.
|
|
||
| #include "Imaging.h" | ||
|
|
||
| #define ROUND_UP(f) ((int)((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F)) |
There was a problem hiding this comment.
Can we make this a function instead?
There was a problem hiding this comment.
Any particular reason?
This was copying
Pillow/src/libImaging/Reduce.c
Line 5 in 27c1bb2
Pillow/src/libImaging/Resample.c
Line 5 in 27c1bb2
If there's a reason to prefer functions, then maybe they should all be changed.
I'd suggest a common function for all three, except that this uses a float and those other two use double.
There was a problem hiding this comment.
Functions are generally safer than macros, which need extra care around parentheses and don't get extra checking. But if this is a copy/paste of existing ones then we should be fine.
Helps #6667