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

Crop images without resizing #9499

Closed
johnsvenn opened this issue Feb 14, 2022 · 5 comments · Fixed by #9549
Closed

Crop images without resizing #9499

johnsvenn opened this issue Feb 14, 2022 · 5 comments · Fixed by #9549

Comments

@johnsvenn
Copy link
Contributor

At the moment Hugo has image processing methods for Fit, Fill, Resize, and Filter. I think it would be very useful to have the ability to Crop an image without resizing (using the disintegration/gift CropToSize method). This would use Anchor in exactly the same way as the existing Fill method to position the crop.

I've already implemented this locally and if anybody else would find this useful I will add tests, update the docs and submit a PR.

@bep
Copy link
Member

bep commented Feb 14, 2022

I think it would be very useful to have the ability to Crop an image without resizing

Yes, we should probably add this, but in what situations would you use this and not Fill?

@johnsvenn
Copy link
Contributor Author

My use case is that I have several hundred very large detailed images (generative art) and I wanted to create smaller thumbnail / summary images that just showed a part of the image but without resizing so none of the detail is lost.

@bep bep added this to the v0.92.2 milestone Feb 14, 2022
@bep
Copy link
Member

bep commented Feb 14, 2022

@johnsvenn OK, a pull request would be welcomed. Just put new documentation in the /docs folder of this repo.

@johnsvenn
Copy link
Contributor Author

Thanks @bep

Will do.

@bep bep modified the milestones: v0.92.2, v0.93.0 Feb 16, 2022
johnsvenn added a commit to johnsvenn/hugo that referenced this issue Feb 22, 2022
Introduces the Crop method for image processing which implements gift.CropToSize. Also allows a smartCrop without resizing, and updates the documentation.

Fixes gohugoio#9499
@bep bep closed this as completed in #9549 Feb 23, 2022
bep pushed a commit that referenced this issue Feb 23, 2022
Introduces the Crop method for image processing which implements gift.CropToSize. Also allows a smartCrop without resizing, and updates the documentation.

Fixes #9499
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants