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

Custom crop sx/sy/sw/sh #9

Merged
merged 1 commit into from
May 8, 2016
Merged

Conversation

AshKyd
Copy link
Collaborator

@AshKyd AshKyd commented May 8, 2016

Optionally crop the source image as the first operation.

Moved the gmImage.size call to after the initial crop (so aspect calcs are correct) which is why the diff is so messy.

function (_callback) {
gmImage.format({
// All params should exist and be numeric.
var hasCrop = _.every(customCrop, function(param){
Copy link
Owner

Choose a reason for hiding this comment

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

Slick

@garrows
Copy link
Owner

garrows commented May 8, 2016

Very nice. What happens if you customCrop an area outside the bounds of the image?

@garrows
Copy link
Owner

garrows commented May 8, 2016

I tested it, it just goes to the width of the image. I'm happy with that. Good job @AshKyd .

@garrows garrows merged commit 485858a into garrows:master May 8, 2016
@AshKyd
Copy link
Collaborator Author

AshKyd commented May 8, 2016

GM handles this by returning a smaller image based on the data it has. If it's completely outside bounds GM will return the original. I've added a test.

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