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

Add functions to save images #324

Open
postcasio opened this issue Jan 6, 2021 · 2 comments
Open

Add functions to save images #324

postcasio opened this issue Jan 6, 2021 · 2 comments

Comments

@postcasio
Copy link
Contributor

postcasio commented Jan 6, 2021

Not sure what the best design for this API would be - whether to offer a save(filename) method on Texture that directly saves the file or a method that returns JPG/PNG binary data to be passed to FS.writeFile. I lean towards the latter for flexibility.

@fatcerberus
Copy link
Member

There's currently an experimental function Texture#download() that returns the raw uncompressed pixels of an image. It would be easy enough to add an extra parameter to say you want the image in PNG format instead.

Note that Sphere v1 has Surface#save() and it does work in neoSphere; I didn't implement image saving in Sphere v2 initially because it didn't seem super useful given how sandboxed the file system is. What are the use cases you're envisioning for this feature?

@postcasio
Copy link
Contributor Author

postcasio commented Jul 22, 2024

Sorry only just noticed this reply :) The download function should be enough for what I was thinking. The use case is storing a thumbnail of the current game screen with save data so it can be displayed in a save game list, similar to this:
image

It could also be useful for a "photo mode" feature, although I'm sure they're not too common in 2D games.

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

No branches or pull requests

2 participants