-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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 minScale to image config #11151
Comments
Somewhat related: muesli/smartcrop#21 Without being configurable, this would change images in the wild. So, proposal instead of bug. |
I just tested it and |
I found a workaround by the way. First you smart crop with the aspect ratio you want, without reducing the width or height (so that {{ with .Resources.GetMatch "example.jpg" }}<!-- 300x200 px -->
{{ $smart := .Fill "200x150" }}
{{ $workaround := (.Fill "300x225 q100").Resize "200x" }}
<img src="{{ .RelPermalink }}">
<img src="{{ $smart.RelPermalink }}">
<img src="{{ $workaround.RelPermalink }}">
{{ end }} |
$image.Fill
with the default smart cropping unnecessarily crops images. Example:example.jpg:
Smart crop (feathers chopped off, unnecessary because same aspect ratio):
Expected:
This does not just apply when the aspect ratio is the same, it unnecessarily crops whenever it feels like it. I would rather not use another anchor because smart cropping would be super useful if it only cropped when necessary. I filed this as a bug rather than a feature request because it is the default behavior and unexpected (for me).
smartcrop.js (which the smartcrop library used in Hugo is based on) has the following option, which appears to prevent this issue:
minScale: minimal scale of the crop rect, set to 1.0 to prevent smaller than necessary crops (lowers the risk of chopping things off).
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes.
The text was updated successfully, but these errors were encountered: