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 · 0 comments
Open

Compress rapid-fire screenshots #54

nmlgc opened this issue Sep 17, 2023 · 0 comments
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 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.
  • 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 🏍️
GIF, optimized 61,290 bytes
PNG, optimized 46,681 bytes 🐌

Despite the slow compression, I'm still heavily leaning towards PNG. If the compression does result in frame drops, the resulting slowdown can provide a nice feedback to players that their hard drive is currently blasted with new image files.

@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
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