Skip to content

Commit

Permalink
fix: image encoding issue when the format is not specified (#4435)
Browse files Browse the repository at this point in the history
fix: give a default format when it's not specified

Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed Jan 20, 2024
1 parent 813ef71 commit 2d73651
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/_bentoml_sdk/validators.py
Expand Up @@ -76,7 +76,7 @@ def decode(self, obj: bytes | t.BinaryIO | UploadFile | PILImage.Image) -> t.Any

def encode(self, obj: PILImage.Image) -> bytes:
buffer = io.BytesIO()
obj.save(buffer, format=obj.format)
obj.save(buffer, format=obj.format or "PNG")
return buffer.getvalue()

def __get_pydantic_core_schema__(
Expand Down

0 comments on commit 2d73651

Please sign in to comment.