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

gtkui: refactor resize_pixbuf_keep_ratio #1107

Merged
merged 1 commit into from Jul 26, 2021

Conversation

ollieparanoid
Copy link
Contributor

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.

@auouymous
Copy link
Member

Other than that, it LGTM, I just need to test it.

@ollieparanoid
Copy link
Contributor Author

Other than that, it LGTM, I just need to test it.

Other than what? :) Sounds like a review comment was not submitted yet?

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.
@auouymous auouymous merged commit dd3a802 into gpodder:master Jul 26, 2021
@auouymous
Copy link
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.
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.

None yet

2 participants