Issue #156 duplicate

Streamline ImageData:encode

Bill Meltsner
created an issue

Currently, to save an image from LÖVE, you need to use ImageData:encode(format) to produce an EncodedImageData, and then use love.filesystem to put it in a file. This is kind of kludgy, and having the separate EncodedImageData step doesn't make a lot of sense since there's really nothing else you can use it for.

Instead, change the method to ImageData:encode(path, format) or ImageData:encode(file, format), passing a string or a File, which encodes the ImageData to the specified format and writes it to the relevant location in one fell swoop. Bonus points for making format optional and autodetecting the proper format from the file extension in its absence.

(Hat tip to itsnotabigtruck for the idea.)

Comments (5)

  1. Log in to comment