Skip to content

[UrlImagePreview] Add PNG and GIF thumbnails to url_image_preview.py

Daniel Brötzmann requested to merge (removed):UrlImagePreviewPNG-GIF into master

Thumbnails created by the UrlImagePreview plugin are stored as JPEG, regardless which file extension is appended (e.g. picture.png has a JPEG header instead of a PNG header).

To avoid this, we can create thumbnails with the corresponding file format, chosen by file extension. This fixes #234 (closed) , I guess? Also, I set the JPG quality to 95, as 100 does not provide better quality but bigger filesizes.

Additionally, for animated content (GIF) there is only a static thumbnail displaying the first frame. Resizing of GIF-files with im.thumbnail will create a thumbnail containing the first frame only. Therefore, this commit passes the GIF-file without resizing.

To allow inline animated GIF-files in the chat window, loader.get_animation has to be used in the process of updating the images in the textview.

Merge request reports