Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Support multiple image formats encoded as base64 #4

Open
brannondorsey opened this issue Apr 9, 2019 · 0 comments
Open

Support multiple image formats encoded as base64 #4

brannondorsey opened this issue Apr 9, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@brannondorsey
Copy link
Member

Right now, runway.data_types.image support serialization via a JPEG encoded image only.

def serialize(self, value):
if type(value) is np.ndarray:
im_pil = Image.fromarray(value)
elif type(value) is Image.Image:
im_pil = value
buffer = IO()
im_pil.save(buffer, format='JPEG')
return 'data:image/jpeg;base64,' + base64.b64encode(buffer.getvalue()).decode('utf8')

We should support multiple image formats, as well as exploring support for higher bit-depth images.

@brannondorsey brannondorsey added the enhancement New feature or request label Apr 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant