eliasdoehne / stellaris-dashboard

A graph dashboard and event log for Stellaris.
123 stars 14 forks source link

Add ability to export as animated webp #78

Closed chennin closed 1 year ago

chennin commented 1 year ago

Adds WebP animated export support. In my test of a tiny galaxy in 2350, the webp was 22% of the size of the gif:

-rw-rw-r-- 1 c c 16159972 Nov 21 19:48 mpseriousempirename_1645140075-2022-11-21-194604.gif
-rw-rw-r-- 1 c c  3572372 Nov 21 19:51 mpseriousempirename_1645140075-2022-11-21-194604.webp

The webp looks like this: https://freeimage.host/i/HJQpqwN

WebP is a "new" image format, where animated WebPs are already well supported by the browsers ("only" since 2020 for Edge); and since 2016 for libwebp and 2017 for Pillow, although I put a feature check on the checkbox, just in case.

The export is slower than gif. The tuning options are explicitly set here to the defaults, for ease of changing if we want to. I added some logging to allow timing, example:

MainProcess - 2022-11-21 19:46:04,604 - stellarisdashboard.dashboard_app.timelapse_exporter - INFO - Exporting animated image
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 458/458 [02:16<00:00,  3.34it/s]
MainProcess - 2022-11-21 19:48:21,587 - stellarisdashboard.dashboard_app.timelapse_exporter - INFO - Exporting timelapse gif to /home/c/stellaris-dashboard/output/galaxy-timelapse/mpseriousempirename_1645140075-2022-11-21-194604.gif
MainProcess - 2022-11-21 19:48:57,266 - stellarisdashboard.dashboard_app.timelapse_exporter - INFO - Exporting timelapse webp to /home/c/stellaris-dashboard/output/galaxy-timelapse/mpseriousempirename_1645140075-2022-11-21-194604.webp
MainProcess - 2022-11-21 19:51:16,693 - stellarisdashboard.dashboard_app.timelapse_exporter - INFO - Exports complete.
eliasdoehne commented 1 year ago

Thank you! :+1: