Daniel Brötzmann pushed to branch ogp-image-preview at gajim / gajim


Commits:
365c179d by cal0pteryx at 2026-02-22T23:59:08+01:00
cfix: OGP: Convert image to RGB if necessary

- - - - -
ba8141e8 by cal0pteryx at 2026-02-22T23:59:32+01:00
cfix: OGP: Fix image width

- - - - -


2 changed files:

- gajim/common/multiprocess/url_preview.py
- gajim/data/gui/preview/open_graph.ui


Changes:

=====================================
gajim/common/multiprocess/url_preview.py
=====================================
@@ -60,6 +60,9 @@ def generate_url_preview(
 def _make_thumbnail(content: bytes) -> OpenGraphThumbnail:
     image = Image.open(io.BytesIO(content))
     image.thumbnail((THUMBNAIL_SIZE, THUMBNAIL_SIZE))
+    if image.mode in ("RGBA", "P"):
+        image = image.convert("RGB")
+
     thumbnail = io.BytesIO()
     image.save(thumbnail, format="JPEG", optimize=True)
     return OpenGraphThumbnail.from_bytes(thumbnail.getvalue(), "image/jpeg")


=====================================
gajim/data/gui/preview/open_graph.ui
=====================================
@@ -24,6 +24,7 @@
           <object class="AdwClamp" id="_picture_clamp">
             <property name="visible">false</property>
             <property name="maximum-size">100</property>
+            <property name="width-request">100</property>
             <child>
               <object class="GtkPicture" id="_picture">
                 <property name="content-fit">cover</property>



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/03a1325755dee68cea13291aab9cf69f27af6f8d...ba8141e86cb4719176e4ee1a0c6d7d2c3683e39d

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/03a1325755dee68cea13291aab9cf69f27af6f8d...ba8141e86cb4719176e4ee1a0c6d7d2c3683e39d
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to