Skip to content

[REF] website: convert default images to WebP format #168862

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SergeBayet
Copy link
Contributor

@SergeBayet SergeBayet commented Jun 11, 2024

This commit switches the default image format from JPEG to WebP for all website images. WebP offers superior compression compared to JPEG, resulting in smaller file sizes and faster website loading times. Additionally, this change helps avoid warnings from performance tools regarding image optimization.

See also: odoo/design-themes#805

task-3167548

@robodoo
Copy link
Contributor

robodoo commented Jun 11, 2024

Pull request status dashboard

@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch from f95f5b2 to 6a56fc7 Compare June 11, 2024 11:32
SergeBayet added a commit to odoo-dev/design-themes that referenced this pull request Jun 11, 2024
This commit switches the default image format from JPEG to WebP for all
design-themes images. WebP offers superior compression compared to JPEG,
resulting in smaller file sizes and faster website loading times.
Additionally, this change helps avoid warnings from performance tools
regarding image optimization.

See also: odoo/odoo#168862

task-3167548
@C3POdoo C3POdoo added the RD research & development, internal work label Jun 11, 2024
@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch 4 times, most recently from 10eb820 to f4a1faf Compare June 12, 2024 07:49
SergeBayet added a commit to odoo-dev/design-themes that referenced this pull request Jun 25, 2024
This commit switches the default image format from JPEG to WebP for all
design-themes images. WebP offers superior compression compared to JPEG,
resulting in smaller file sizes and faster website loading times.
Additionally, this change helps avoid warnings from performance tools
regarding image optimization.

See also: odoo/odoo#168862

task-3167548
@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch 2 times, most recently from 132d01d to a286364 Compare November 14, 2024 10:12
SergeBayet added a commit to odoo-dev/design-themes that referenced this pull request Nov 14, 2024
This commit switches the default image format from JPEG to WebP for all
design-themes images. WebP offers superior compression compared to JPEG,
resulting in smaller file sizes and faster website loading times.
Additionally, this change helps avoid warnings from performance tools
regarding image optimization.

See also: odoo/odoo#168862

task-3167548
@SergeBayet SergeBayet marked this pull request as ready for review November 14, 2024 11:41
@C3POdoo C3POdoo requested review from a team November 14, 2024 11:43
@AntoineVDV AntoineVDV removed the request for review from a team November 18, 2024 07:20
Copy link
Contributor

@qsm-odoo qsm-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergeBayet Once you can, this will probably need a rebase too, on top of my comments 🙏 Don't hesitate to push for this kind of PR to be merged quickly. It's partly my fault this lingered in the Testing BE column for this long (even though anyone could have merged it) but... 😉

Comment on lines 486 to 488
# Currently we're using Pillow 9.0.1, and this version doesn't handle webp
# We should upgrade to version >=10.1.0. Thus this workaround.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just remove this comment, or add it next to the get_webp_size definiton maybe.

Comment on lines 485 to 490
if record.mimetype == "image/webp":
# Currently we're using Pillow 9.0.1, and this version doesn't handle webp
# We should upgrade to version >=10.1.0. Thus this workaround.
width, height = tuple(str(size) for size in get_webp_size(image))
else:
img = binary_to_image(image)
width, height = tuple(str(size) for size in img.size)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to the work you are doing in this commit? I am not sure what this is about but it feels like a fix that maybe should target stable?

Copy link
Contributor Author

@SergeBayet SergeBayet Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the tests emit some warnings:

image

But yes it should target stable. I'm gonna create a PR for this bug-fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qsm-odoo Here's the PR #214706 targeting 17.0

@SergeBayet
Copy link
Contributor Author

@SergeBayet Once you can, this will probably need a rebase too, on top of my comments 🙏 Don't hesitate to push for this kind of PR to be merged quickly. It's partly my fault this lingered in the Testing BE column for this long (even though anyone could have merged it) but... 😉

I'll take care of that as soon as possible. Thanks for the review :)

@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch from a286364 to c5ce5d4 Compare June 17, 2025 11:42
SergeBayet added a commit to odoo-dev/design-themes that referenced this pull request Jun 17, 2025
This commit switches the default image format from JPEG to WebP for all
design-themes images. WebP offers superior compression compared to JPEG,
resulting in smaller file sizes and faster website loading times.
Additionally, this change helps avoid warnings from performance tools
regarding image optimization.

See also: odoo/odoo#168862

task-3167548
@C3POdoo C3POdoo requested review from a team June 17, 2025 11:50
@SergeBayet
Copy link
Contributor Author

SergeBayet commented Jun 24, 2025

@qsm-odoo Ready to review. 👍 We have to bypass ci/style check: it's about the size of several images that reach the 100k limit but still less than before :)

@d-fence
Copy link
Contributor

d-fence commented Jun 24, 2025

robodoo override=ci/style

@SergeBayet
Copy link
Contributor Author

@qsm-odoo in order to improve this PR, I'll adjust the conversion. Convert only these files:

  • size > 10k (or maybe 20k, I'll test)
  • target_size / original_size < 0.7

FYI @xmo-odoo

@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch 3 times, most recently from 6d87a60 to 721f785 Compare June 24, 2025 12:52
@C3POdoo C3POdoo requested a review from a team June 24, 2025 13:19
@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch 2 times, most recently from 89f46aa to ead9905 Compare June 25, 2025 08:02
@SergeBayet
Copy link
Contributor Author

@qsm-odoo PR is ready to be reviewed. Thanks :)

@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch 2 times, most recently from 707cd6e to 7abcae8 Compare June 26, 2025 12:00
SergeBayet added a commit to odoo-dev/design-themes that referenced this pull request Jun 26, 2025
This commit switches the default image format from JPEG to WebP for all
design-themes images. WebP offers superior compression compared to JPEG,
resulting in smaller file sizes and faster website loading times.
Additionally, this change helps avoid warnings from performance tools
regarding image optimization.

See also: odoo/odoo#168862

task-3167548
@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch from 7abcae8 to 4dace49 Compare June 27, 2025 08:22
SergeBayet added a commit to odoo-dev/design-themes that referenced this pull request Jun 27, 2025
This commit switches the default image format from JPEG to WebP for all
design-themes images. WebP offers superior compression compared to JPEG,
resulting in smaller file sizes and faster website loading times.
Additionally, this change helps avoid warnings from performance tools
regarding image optimization.

See also: odoo/odoo#168862

task-3167548
@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch 2 times, most recently from bb0e873 to f17006f Compare June 27, 2025 15:53
SergeBayet added a commit to odoo-dev/design-themes that referenced this pull request Jun 27, 2025
This commit switches the default image format from JPEG to WebP for all
design-themes images. WebP offers superior compression compared to JPEG,
resulting in smaller file sizes and faster website loading times.
Additionally, this change helps avoid warnings from performance tools
regarding image optimization.

See also: odoo/odoo#168862

task-3167548
This commit switches the default image format from JPEG to WebP for all
website images. WebP offers superior compression compared to JPEG,
resulting in smaller file sizes and faster website loading times.
Additionally, this change helps avoid warnings from performance tools
regarding image optimization.

task-3167548
@SergeBayet SergeBayet force-pushed the master-default-images-in-webp-seba branch from f17006f to bb8ba42 Compare June 27, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants