{"id":6898,"library":"streamlit-image-coordinates","title":"Streamlit Image Coordinates","description":"Streamlit-image-coordinates is a Streamlit component that displays an image and returns the coordinates when a user clicks on it. It also provides the click event time in Unix format. The current stable version is `0.4.0`, and the library is actively maintained with regular updates.","status":"active","version":"0.4.0","language":"en","source_language":"en","source_url":"https://github.com/blackary/streamlit-image-coordinates","tags":["streamlit","image processing","coordinates","component","gui","interactive"],"install":[{"cmd":"pip install streamlit-image-coordinates","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required for the component to function within a Streamlit application.","package":"streamlit","optional":false},{"reason":"Often used for image manipulation (e.g., drawing on images) when handling PIL Image objects with the component.","package":"Pillow","optional":true}],"imports":[{"symbol":"streamlit_image_coordinates","correct":"from streamlit_image_coordinates import streamlit_image_coordinates"}],"quickstart":{"code":"import streamlit as st\nfrom streamlit_image_coordinates import streamlit_image_coordinates\n\nst.title(\"Streamlit Image Coordinates Demo\")\n\nst.write(\"Click on the image to get its coordinates:\")\nvalue = streamlit_image_coordinates(\"https://placekitten.com/200/300\")\n\nif value:\n    st.write(f\"Clicked at: x={value['x']}, y={value['y']}\")\n    if 'time' in value:\n        st.write(f\"Click time (Unix): {value['time']}\")\nelse:\n    st.write(\"No click detected yet.\")","lang":"python","description":"This example demonstrates how to display an image and capture click coordinates using `streamlit_image_coordinates`. The returned `value` is a dictionary containing 'x', 'y', and optionally 'time'."},"warnings":[{"fix":"Refer to the official GitHub repository and PyPI release notes for updates and potential breaking changes when upgrading.","message":"The library is listed with a 'Development Status :: 3 - Alpha' on PyPI. While actively maintained, this implies that breaking changes could occur in future releases as the project matures.","severity":"gotcha","affected_versions":"<=0.4.0"},{"fix":"Consider structuring your app so that coordinate capture happens outside of a `st.form` context if dynamic updates are required, or manage state carefully within fragments. Refer to Streamlit community discussions for potential workarounds.","message":"Using `streamlit_image_coordinates` for dynamic updates (e.g., drawing points on an image after a click) inside `st.form` might not work as expected and can be challenging to implement without `st.rerun()` or `st.experimental_fragment` which might break form submission logic.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to version 0.1.3 or higher for improved dynamic update behavior. If still encountering issues, ensure state is managed with `st.session_state` and consider setting the `key` parameter to allow the component to update correctly.","message":"For older versions (prior to 0.1.3), updating an image dynamically after a click often required explicit use of `st.experimental_rerun()` to reflect changes. Newer versions (0.1.3 onwards) improved this behavior, reducing the need for manual reruns in many cases.","severity":"gotcha","affected_versions":"<0.1.3"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}