Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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"]
)