Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compress rapid-fire screenshots #54

Open
nmlgc opened this issue Sep 17, 2023 · 1 comment
Open

Compress rapid-fire screenshots #54

nmlgc opened this issue Sep 17, 2023 · 1 comment
Assignees
Labels
Enhancement New feature or request Graphics ~≤0.33 pushes Projected number of pushes needed. Might turn out to get more expensive!

Comments

@nmlgc
Copy link
Owner

nmlgc commented Sep 17, 2023

The original game's screenshot feature (#15) only writes uncompressed .BMP files that take up quite a bit of disk space. Due to the rapid-fire nature of these screenshots, this can add up to hundreds of MB very quickly.

Nowadays, there are two three main contenders for lossless compressed image formats:

  • PNG: Widely supported, best compression, but very slow. So slow that it might cause frame drops when holding the screenshot key.
  • QOI: Released in November 2021, quickly became famous for its simplicity and encoding speed, and is quickly gaining support in other programs. However, its compression algorithm was not built with heavily dithered 256-color source images in mind, and it would therefore compress Shuusou Gyoku screenshots rather poorly. Just mentioning it here because I'm sure that someone would recommend it otherwise.
  • Lossless JPEG-XL: Fast, decently small files on even the lowest effort setting, and we might even want to go higher?
  • GIF: Would actually compress only slightly worse than PNG, but 256 colors are probably not enough once Direct3D-rendered transparent shapes come into play.

None of these are part of SDL, so we'd have to add another library in any case.

Here's a decently busy reference screenshot:
A decently busy reference screenshot

Format File size Encoding speed
BMP, 32-bit 1,228,854 bytes 🏎️
QOI 179,201 bytes 🏍️
JPEG-XL, -e 1 128,955 bytes 🏍️
GIF, optimized 61,290 bytes
PNG, optimized 46,681 bytes 🐌
@nmlgc nmlgc added Enhancement New feature or request Graphics ~≤0.33 pushes Projected number of pushes needed. Might turn out to get more expensive! labels Sep 17, 2023
@nmlgc nmlgc self-assigned this Aug 1, 2024
@nmlgc
Copy link
Owner Author

nmlgc commented Aug 1, 2024

The JPEG-XL variant received funding from Ember2528's Seihou subscription and will be done after #36.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Graphics ~≤0.33 pushes Projected number of pushes needed. Might turn out to get more expensive!
Projects
None yet
Development

No branches or pull requests

1 participant