gtkui: refactor resize_pixbuf_keep_ratio - #1107
Merged
Merged
Conversation
Member
|
Other than that, it LGTM, I just need to test it. |
Contributor
Author
Other than what? :) Sounds like a review comment was not submitted yet? |
auouymous
reviewed
Jul 24, 2021
Do all image size calculation before calling scale_simple, so it only needs to be called once. Add a debug log message, since scaling cover images actually takes some time and it's good to know the target resolution. (On my PinePhone, scaling these cover images delays startup significantly and thumbnails are too small when the program is scaled in the Phosh UI). While at it, return early if no resize is needed so the changed and result variables can be removed. Calling scale_simple twice happens with the previous code, if the height of the source image is greater than max_image_side and greater than the width. In that case, the resulting image has less quality since the second scale_simple already works with a scaled down image and scaling takes twice as long. In practice most podcasts have square artwork so I assume this didn't have much of a practical effect. But I care about the log message and figured this would be the most elegant way to add it.
ollieparanoid
force-pushed
the
refactor-resize-pixbuf
branch
from
July 24, 2021 07:23
ed9c746 to
d8d68e1
Compare
Member
|
Thanks for the patch, it will improve the performance of a feature I'm working on. |
auouymous
added a commit
to auouymous/gpodder
that referenced
this pull request
Aug 15, 2021
elelay
added a commit
that referenced
this pull request
Aug 18, 2021
Move scale_pixbuf to util.py and apply #1107 refactoring.
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.
Do all image size calculation before calling scale_simple, so it only
needs to be called once.
Add a debug log message, since scaling cover images actually takes some
time and it's good to know the target resolution. (On my PinePhone,
scaling these cover images delays startup significantly and thumbnails
are too small when the program is scaled in the Phosh UI).
While at it, return early if no resize is needed so the changed and
result variables can be removed.
Calling scale_simple twice happens with the previous code, if the height
of the source image is greater than max_image_side and greater than the
width. In that case, the resulting image has less quality since the
second scale_simple already works with a scaled down image and scaling
takes twice as long. In practice most podcasts have square artwork so
I assume this didn't have much of a practical effect. But I care about
the log message and figured this would be the most elegant way to add it.