seahub icon indicating copy to clipboard operation
seahub copied to clipboard

Thumbnails for JPGs are served in PNG format

Open MarcusRiemer opened this issue 5 years ago • 4 comments

Thumbnails that are fetched via URLs like https://seafile/thumbnail/fe2514c3-ef76-4f92-8f78-175e5034a688/192/IMG_20190102_084007.jpg seem to be always encoded as PNG. For photos this often adds a substantial overhead. I downloaded an example thumbnail (thumb.jpg.png) and converted it to JPG via magick convert thumb.jpg.png thumb.jpg. For a "typical" photo from an Android smartphone this results in the following sizes:

marcus@rechenknecht:~/d/seafile-test >>> magick convert thumb.jpg.png thumb.jpg
marcus@rechenknecht:~/d/seafile-test >>> du *
16K	thumb.jpg
52K	thumb.jpg.png

Would it be possible to serve the thumbnails using the same encoding that they had originally?

MarcusRiemer avatar Aug 18 '19 18:08 MarcusRiemer

Not exactly what you wanted but when you add

THUMBNAIL_EXTENSION = 'JPEG'

to conf/seahub_settings.py all thumbnails get served as JPEGs. You might want to delete the contents of seahub-data/thumbnail after that.

ao8833 avatar Sep 08 '19 13:09 ao8833

@MarcusRiemer @ao8833, I suggest using the following setting:

THUMBNAIL_EXTENSION = 'webp'

This will preserve the transparency of the PNG and reduce the size of thumbnails. WEBP is now supported by all modern browsers:

poofeg avatar Mar 03 '21 10:03 poofeg

@poofeg seafile doesn't (currently) support webp in the WebUI it seems - when you browse to a webp image you get the following error:

Online view is not applicable to this file format

Might also need to add this to a whitelist somewhere. Perhaps FILEEXT_ICON_MAP{} in seahub/base/templatetags/seahub_tags.py?

(I'm using Pro 7.1.14)

I have opened #4867 which should probably be addressed before serving thumbnails as webp.

draeath avatar Apr 09 '21 22:04 draeath

@draeath, I'm using Seafile 8.0.2, THUMBNAIL_EXTENSION = 'webp' works without any problems.

poofeg avatar Apr 10 '21 12:04 poofeg