turner-anderson / streamlit-cropper

A simple image cropper for Streamlit
MIT License
182 stars 26 forks source link

why does it bring white to the edge of the picture? #14

Closed damladalgic closed 11 months ago

damladalgic commented 1 year ago
Screenshot 2022-12-21 194852
turner-anderson commented 1 year ago

Could you see if this still happens on the version most recently pushed?

fizahkhalid commented 1 year ago

Could you see if this still happens on the version most recently pushed?

Yes it done.

turner-anderson commented 1 year ago

Odd, I can't replicate the behavior. Could you give me a few more details on the environment and possibly how you're calling the cropper or whether you're using it in one of the streamlit container objects? You could try creating a new environment and pip installing streamlit-cropper, then copying app.py and seeing if that works as expected.

Here's my environment:

Windows 10 Python 3.11.1 Streamlit 1.16.0 streamlit-cropper 0.2.1 Chrome, Firefox and Edge browsers tested

fizahkhalid commented 1 year ago

Sure Here's my environment: Ubuntu (AWS EC2 Server) Python 3.8.15 streamlit 1.16.0 streamlit-cropper 0.2.0 and 0.2.1 (both tested) Chrome tested

This issue persisted in 2 different conda environments.

I believe image size has something to do with it. Most of the images I used only have this white area in "Wide Mode". The following image has it on both settings. WIDE MODE: image

WITHOUT WIDE MODE: image

turner-anderson commented 1 year ago

So from what I can tell this happens because Streamlit dynamically stretches the container that the image is in, it's especially noticeable if your computer/browser is in dark mode, because the canvas doesn't know to fill with black. I'm trying to figure out a way to force the component to not resize, but it may take some time.

fizahkhalid commented 1 year ago

Yes that is probably what's happening. I don't think theres any need to spend ample time on this. It is seamless in light mode. Thanks a lot for this library !

turner-anderson commented 11 months ago

Exciting news, I think I fixed it on the latest release.