-
Notifications
You must be signed in to change notification settings - Fork 193
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
Add simple (and naive) implementation of pixelate filter #224
Conversation
vips/image.go
Outdated
@@ -1180,6 +1180,40 @@ func (r *ImageRef) ModulateHSV(brightness, saturation float64, hue int) error { | |||
return nil | |||
} | |||
|
|||
// Pixelate applies a simple pixelate filter to the image | |||
func (r *ImageRef) Pixelate(factor float64) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to assert that factor > 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is a little specific to hang on ImageRef
type.
How would you feel about making this a utility method that takes in (and maybe return a new ImageRef)? Or it can modify in place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I placed it under ImageRef is that to my understanding the same effect can be archived by with a single pass on the image, and I didn't want to end up with two APIs that do the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, all I'm saying is that we could easily do:
func Pixelate(image *ImageRef, factor float64) error {
// your code
}
I mean, I know there's a bunch of things on ImageRef already, I do wish it were more minimal and the "modifiers" of it were separate functions. WDYT? Let me know and we can merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, this way we won't end up with BC (issues) later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BC? (bloated code)? (maybe im being dumb, it's early here in Paris)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backwards Compatible :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, all I'm saying is that we could easily do:
func Pixelate(image *ImageRef, factor float64) error { // your code }
I mean, I know there's a bunch of things on ImageRef already, I do wish it were more minimal and the "modifiers" of it were separate functions. WDYT? Let me know and we can merge
Implemented
# Conflicts: # vips/image_golden_test.go
# Conflicts: # vips/image.go
A pixelate filter based on simple resize steps.