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

added img_bytes prop #152

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions streamlit_drawable_canvas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ class CanvasResult:
RGBA Matrix of Image Data.
json_data: dict
JSON string of canvas and objects.
image_bytes:
DataURL string of Image Data
"""

image_data: np.array = None
json_data: dict = None
image_bytes: bytes = None


def _data_url_to_image(data_url: str) -> Image:
Expand Down Expand Up @@ -156,4 +159,5 @@ def st_canvas(
return CanvasResult(
np.asarray(_data_url_to_image(component_value["data"])),
component_value["raw"],
component_value["data"]
)