Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Filter for making a round image. #280

Closed
wants to merge 3 commits into from
Closed

[FEATURE] Filter for making a round image. #280

wants to merge 3 commits into from

Conversation

chrootlogin
Copy link

Adds a new filter that creates a same sized empty copy of the image with transparent background. With the radius you set it calculates if a pixel is in- or outside the circle, if it's inside then it copies it to the new picture.

* If you set the radius bigger then the half size of the
* image it let you create round corners.
*
* @param int|boolean $radius Sets the radius, if false it will use half of the smaller side
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use null, not false

This method does not accept a boolean (true is not a valid value), it only need to have a case for not provided integer, and the right way to specify the absence of value is null, not false

@romainneutron
Copy link
Collaborator

Hello, thanks for your contribution ! Could you have a look at comments and add unit tests ?

@chrootlogin
Copy link
Author

Hey guys
Thank you for your answers! I will try to fix this in a few days.

@Richtermeister
Copy link
Contributor

I would love to have a circular filter. I just wonder how this "copy pixels" approach stacks up against the approach of creating a circular mask and using it to mask the original image, in particular with regards to being able to anti-alias the edge of the circle.

Just curious, I haven't tried either approach myself yet.

@mlocati
Copy link
Collaborator

mlocati commented Sep 4, 2018

I agree with @Richtermeister and @stof. Furthermore, we already have the great applyMask that works great, and it's much more flexible: you can use it to make an image round (or elliptical, or whatever). That's why I'm closing this.

@mlocati mlocati closed this Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants