Repository navigation
Conversation
mstoeckl
approved these changes
Nov 10, 2026
Contributor
There was a problem hiding this comment.
This change looks mechanically OK (I've tested it by temporarily modifying examples/scaledown/main.rs) and I think the API is reasonable and useful.
I should warn that the new function replicates two existing issues of resize_to_fill :
- the intermediate image dimensions (width2, height2) may exceed the original file size (A 1x1048576 image thumbnailed to 64x64 produces (width2, height2) = (64,67108864; see #3083.)
- Having separate scale and crop steps will fail to center images exactly. For example, scaling when scaling a 500x400 image down to 4x4 pixels, the thumbnail may either show the left 400x400 block or the right 400x400 block.
If either is fixed, applying the fixes to both resize_to_fill and thumbnail_to_fill may be easy. (But cleanly fixing both likely requires implementing a single step "scale+crop" primitive, which may take a bit of work.)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements feature request #3109 that matches
DynamicImage::resize_to_fillwithDynamicImage::thumbnail_to_fill.