Please sign in to comment.
[IMP] tools,base: keep image ratio on resize
Before ====== Since commit: 2e3848b The images that are resized have additional borders if the target ratio is different than the image ratio. Those borders are transparent if the image format supports it, and are white otherwise. With that current solution, if the background where the image is displayed is another color than white, it is looking really bad. Moreover, most images are stored resized like this, so it is not even possible to decide if it should have borders or not depending on the context, the original image and ratio is forever lost. It is also inconsistent because if the image is already smaller than the target size then it doesn't include borders. In that case it keeps the original ratio instead of the target ratio. So it isn't even guaranteed that the target ratio is going to be respected. After ===== This commit will solve all of those problems by always keeping the ratio of the original image. This implies the views should be taking care of adding borders when necessary. PR: #31811
- Loading branch information...
Showing with 71 additions and 160 deletions.
- +2 −3 addons/web/controllers/main.py
- +1 −2 addons/web/models/ir_qweb.py
- +1 −1 addons/website_partner/views/website_partner_templates.xml
- +2 −2 addons/website_profile/controllers/main.py
- +12 −12 addons/website_sale/tests/test_website_sale_image.py
- +2 −2 addons/website_slides/controllers/main.py
- +1 −1 odoo/addons/base/models/image_mixin.py
- +2 −2 odoo/addons/base/models/res_partner.py
- +20 −33 odoo/addons/base/tests/test_image.py
- +28 −102 odoo/tools/image.py
Oops, something went wrong.