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

Inherit scale and location properties #7

Open
DirkRemmers opened this issue Apr 14, 2022 · 1 comment
Open

Inherit scale and location properties #7

DirkRemmers opened this issue Apr 14, 2022 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@DirkRemmers
Copy link

DirkRemmers commented Apr 14, 2022

Hey all, what a great visualization tool!

I might have a suggestoin that would make it even nicer to use.

The main thing that would improve the usability a lot would be 'automatic scaling'.
Even with the use of different screen sizes, the image-comparison result will always have a fixed size (pixel based)
If you're only working on one device, you can tailor it for this. Unfortunately this won't be the case for many uses though. Therefore I believe that it would be beneficial to make the size scalable, just as all 'default' streamlit plotting options, like st.image. At this moment, some funny things can happen when using columns, or calling other streamlit objects after calling image_comparison().

As a simplified example of what I mean, I added a screenshot of how my app looks, after I've called the following code:

# set columns
cols = st.columns(2)

# define which image you want to see
image_sel = cols[0].selectbox('Select the image you want to see.', image_name_list)

# next I want to see this image using image_comparison
image_comparison(image_1, image_2)

# beneath the image I want to call an expander to modify some settings of this image
modifier = cols[0].form('Modify this image')
with modifier:
    threshold = st.slider(f"Select a new threshold. The default threshold = 19.", 1, 100, 19, 1)
    if st.form_submit_button('Re-analyze image.'):
        image_dict = analyze_image(image_dict) # image_dict contains all metadata and images for this selected image, and is updated by using the different threshold

cols[1].plotly_chart(figure)

As you can see, the order of the calls does not correspond to the location of the image_comparison result.
Screenshot from 2022-04-14 16-44-52

In the end, I would imagine calling image_comparison like:
st.image_comparison, or col1.image_comparison

I don't know how much work this is though.
Let me know what you think, and again, thank you for the nice tool!

Cheer,
Dirk

@DirkRemmers DirkRemmers changed the title Can we make this a streamlit component? Inherit scale properties Apr 14, 2022
@DirkRemmers DirkRemmers changed the title Inherit scale properties Inherit scale and location properties Apr 14, 2022
@fcakyon
Copy link
Owner

fcakyon commented Jun 7, 2022

Hello @DirkRemmers, unfortunately, I don't know much CSS/JS so not sure how to make the component more responsive.. I am open for PRs though!

@fcakyon fcakyon added the help wanted Extra attention is needed label Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants