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

Resize favicons before storing them #2998

Merged
merged 1 commit into from
Dec 16, 2024
Merged

Conversation

jvoisin
Copy link
Collaborator

@jvoisin jvoisin commented Dec 9, 2024

Some websites are using images of O(10kB) when not O(100kB) for their favicons. As miniflux only displays them with a 16x16 resolution, let's do our best to resize them before storing them in the database. This should make miniflux consume less bandwidth when serving pages, for the joy of mobile users on a small data plan.

@jvoisin jvoisin marked this pull request as ready for review December 11, 2024 04:07
@fguillot
Copy link
Member

Is there a way to avoid resizing the image if the size is already 16x16? Optionally, adding a unit test would be nice.

@jvoisin jvoisin force-pushed the resize_icons branch 2 times, most recently from 512ccb5 to a295840 Compare December 13, 2024 18:33
@jvoisin
Copy link
Collaborator Author

jvoisin commented Dec 13, 2024

Tests and checks added :)

@jvoisin jvoisin force-pushed the resize_icons branch 2 times, most recently from f0a00aa to 7fb50f1 Compare December 13, 2024 18:37
Some websites are using images of O(10kB) when not )O(100kB) for their
favicons. As miniflux only displays them with a 16x16 resolution, let's do our
best to resize them before storing them in the database. This should make
miniflux consume less bandwidth when serving pages, for the joy of mobile users
on a small data plan.

Of course, images that already are 16x16 aren't resized.
@fguillot fguillot merged commit 777d0dd into miniflux:main Dec 16, 2024
16 checks passed
@michaelkuhn
Copy link
Contributor

I haven't had a chance to actually test this yet, but do you know how this interacts with scaling? For example, Miniflux's 16x16 favicons are actually displayed using 32x32 device pixels on my desktop with 2x scaling. I'm assuming that resizing them down to 16x16 will make them (more) blurry. Maybe using 32x32 or even 48x48 might be a safer option.

@jvoisin
Copy link
Collaborator Author

jvoisin commented Dec 16, 2024

Oh, good point! 32x32 sounds good to me, why 48x48? Are there really people downscaling resolution 3 times?

jvoisin added a commit to jvoisin/v2 that referenced this pull request Dec 16, 2024
@jvoisin jvoisin deleted the resize_icons branch December 16, 2024 21:54
fguillot pushed a commit that referenced this pull request Dec 17, 2024
WShihan pushed a commit to WShihan/miniflux that referenced this pull request Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants