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

Add 'cropSymmetric' to AutoCrop #461

Merged
merged 5 commits into from
Sep 5, 2018

Conversation

f-barth
Copy link
Contributor

@f-barth f-barth commented Jul 13, 2018

Why?

  • I have a use-case that needs autocropping, but in a symmetric way. That means if I crop 2 pixels from the left I also want to crop 2 pixels from the right to keep the image centred.

What?

  • Add configuration of autocrop via options object: The parameters to autocrop were parsed "by-type" which did not allow adding a second boolean flag. I added the option to configure autocrop via an options object.
  • Add symmetric autocrop: if enabled "horizontal crop = Math.min(left crop, right crop)", same for vertical
  • Add tests for the two above.

Notes:

  • Community Maintainer Guidelines #223 mentioned the idea of using option objects instead of maaany parameters. I took up the idea. autocrop still is does handle the "old" invocation via parameters. All "old" parameters and symmetric autocropping can also be configured via options object.

* Add configuration of autocrop via options object
* Add symmetric autocrop
@hipstersmoothie hipstersmoothie added enhancement a request for a new feature or change in behavior breaking needs a major release and removed enhancement a request for a new feature or change in behavior labels Aug 4, 2018
@hipstersmoothie hipstersmoothie added enhancement a request for a new feature or change in behavior and removed breaking needs a major release labels Sep 3, 2018
@hipstersmoothie
Copy link
Collaborator

@edi9999 This one is good to go now too.

@hipstersmoothie hipstersmoothie changed the title Add symmetric autocropping Add 'cropSymmetric' to AutoCrop Sep 3, 2018
@hipstersmoothie hipstersmoothie merged commit f619590 into jimp-dev:master Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement a request for a new feature or change in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants