Skip to content

Conversation

@Rishab87
Copy link
Contributor

@Rishab87Rishab87 commented Mar 13, 2025

In this PR I've clamped radius to ensure we calculate maximum allowed blur in case of too large values relative to the image
I've also added a check for sum to make it 1 if it is 0 because it can be still zero in some cases even after clamping.

I tested it for the code provided in the issue and it works without crashing:

voidsetup(){size(100, 100, P3D)} voiddraw(){background(0); ellipse(50, 50, 80, 80); filter(BLUR, 29)}

Output:
image

Their can be other approaches too, like throwing a meaningful error for the users.

This PR fixes#723

@SableRafSableRaf requested a review from SteftervMarch 13, 2025 09:20
@Stefterv
Copy link
Collaborator

Hi @Rishab87 thank you for your work on this, just a quick question, you are clamping the input value as well as doing a safer divide? Could you explain why do both?

@Rishab87
Copy link
ContributorAuthor

even after clamping I think their can be few edge cases like when loop would iterate a few times where sum can accumulate to zero though I'm not completely sure about this to be honest

@SteftervStefterv added this to the 4.4.1 milestone Mar 13, 2025
@SableRafSableRaf merged commit ff78d90 into processing:mainMar 21, 2025
11 checks passed
Sign up for freeto 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.

Blur filter throws exception if extent is too large relative to image size

3 participants

@Rishab87@Stefterv@SableRaf