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

Support multiple image formats encoded as base64 #4

@brannondorsey

Description

@brannondorsey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions