luigi12345
commited on
Commit
•
54ff357
1
Parent(s):
a4f839e
Cropping Works
Browse files
app.py
CHANGED
@@ -167,12 +167,13 @@ def main():
|
|
167 |
ax.axis('off')
|
168 |
cols[3].pyplot(fig)
|
169 |
|
170 |
-
# Make cropped image downloadable
|
171 |
buf = io.BytesIO()
|
172 |
Image.fromarray(cropped_image).save(buf, format="PNG")
|
|
|
173 |
st.sidebar.download_button(
|
174 |
label="Download Cropped Image",
|
175 |
-
data=
|
176 |
file_name="cropped_image.png",
|
177 |
mime="image/png"
|
178 |
)
|
|
|
167 |
ax.axis('off')
|
168 |
cols[3].pyplot(fig)
|
169 |
|
170 |
+
# Make cropped image downloadable by converting it to bytes
|
171 |
buf = io.BytesIO()
|
172 |
Image.fromarray(cropped_image).save(buf, format="PNG")
|
173 |
+
byte_img = buf.getvalue()
|
174 |
st.sidebar.download_button(
|
175 |
label="Download Cropped Image",
|
176 |
+
data=byte_img,
|
177 |
file_name="cropped_image.png",
|
178 |
mime="image/png"
|
179 |
)
|