I have this code to put an image as background:
def get_base64_of_bin_file(bin_file):
with open(bin_file, ‘rb’) as f:
data = f.read()
return base64.b64encode(data).decode()
def set_png_as_page_bg(png_file):
bin_str = get_base64_of_bin_file(png_file)
page_bg_img = f"“”
html, body, [data-testid=“stApp”] {{
height: 100%;
margin: 0;
padding: 0;
}}
[data-testid=“stApp”] {{
background-image: url(“data:image/png;base64,{bin_str}”);
background-size: cover;
background-position: center top;
background-repeat: no-repeat;
background-attachment: fixed;
min-height: 100vh;
}}
“”"
st.markdown(page_bg_img, unsafe_allow_html=True)
return
But the image is shown cut in the height:
This is the real image:
how can i do make the image shown fully, ans is there a way to make it responsive to the window size?