streamlit-cropper icon indicating copy to clipboard operation
streamlit-cropper copied to clipboard

Enforcing selected aspect ratio

Open ADClark opened this issue 3 months ago • 0 comments

I would expect that when an aspect ratio is selected, the user-modified bounding box would always maintain that same aspect ratio. However, when an aspect_ratio is provided, even though the recommended_box respects that aspect ratio, the drag handles on the box allow for cropping to any aspect ratio. Further, the box reveals a rotation handle which does not play nicely with how the return_type='box' gets calculated.

Lastly, while exploring the component's logic, I noticed that lines 166-167 of init.py if aspect_ratio: lock_aspect = True

but then line 179 of init.py includes lockAspect=not lock_aspect

All of which has left me a bit confused. Any input or thoughts from the community for enforcing an aspect ratio with streamlit_cropper would be appreciated. This is a valuable component and is still the most functional solution I have come across.

ADClark avatar Oct 29 '24 19:10 ADClark