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

Save surface to file efficiently #121

Open
Beuc opened this issue Jan 24, 2020 · 0 comments
Open

Save surface to file efficiently #121

Beuc opened this issue Jan 24, 2020 · 0 comments

Comments

@Beuc
Copy link
Contributor

Beuc commented Jan 24, 2020

Hi,

While experimenting with generating low-res (highly pixellated through renpy.display.module.pixellate) image placeholders for RenPyWeb with on-demand resource download, generated from the Laucher, I needed an efficient way to save such placeholders on disk (for inclusion in game.zip, downloaded on game startup).

The JPG function is not well suited for this: even with a 0 quality the file size is still pretty high compared to other options.

The PNG function works but does not compare with e.g. GIMP or ImageMagick wrt size efficiency (which requires some PNG line filters heuristic and/or brute-force AFAIU). In addition, it does not support 8-bit colors which would help in this context.

There is no WEBP support, and my tests indicate that this format would be more size-efficient for saving such placeholders on disk. So adding WEBP support to pygame_sdl2.image.save would help.

I may or may not find another trick to save image placeholders efficiently (I plan to experiment with shrinking+scaling back).
I'm tentatively posting this to know whether WEBP saving support would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant