FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support ImageFilter.BuiltinFilter for I;16* images by radarhere · Pull Request #8438 · python-pillow/Pillow · GitHub

Support ImageFilter.BuiltinFilter for I;16* images - #8438

Merged
radarhere merged 2 commits into
python-pillow:mainfrom
radarhere:filter
Oct 10, 2024
Merged

Support ImageFilter.BuiltinFilter for I;16* images#8438
radarhere merged 2 commits into
python-pillow:mainfrom
radarhere:filter

Conversation

Copy link
Copy Markdown
Member

Helps #6667

if mode[0] != "I" or (
callable(filter_to_apply)
and issubclass(filter_to_apply, ImageFilter.BuiltinFilter)
):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread src/libImaging/Filter.c

#include "Imaging.h"

#define ROUND_UP(f) ((int)((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can we make this a function instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Any particular reason?

This was copying

#define ROUND_UP(f) ((int)((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F))
and
#define ROUND_UP(f) ((int)((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F))

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

radarhere merged commit 7777260 into python-pillow:main Oct 10, 2024
radarhere deleted the filter branch October 10, 2024 11:44
radarhere pushed a commit that referenced this pull request Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL