{"id":13738289,"url":"https://github.com/fcakyon/streamlit-image-comparison","last_synced_at":"2025-04-04T14:09:47.511Z","repository":{"id":45855728,"uuid":"431648330","full_name":"fcakyon/streamlit-image-comparison","owner":"fcakyon","description":"Image comparison slider component for Streamlit","archived":false,"fork":false,"pushed_at":"2024-07-10T15:36:12.000Z","size":36,"stargazers_count":240,"open_issues_count":8,"forks_count":28,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T13:07:17.331Z","etag":null,"topics":["huggingface","image-slider","machine-learning","pip","pypi","python","streamlit","visualization"],"latest_commit_sha":null,"homepage":"https://huggingface.co/spaces/fcakyon/streamlit-image-comparison","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fcakyon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"fcakyon"}},"created_at":"2021-11-24T22:47:12.000Z","updated_at":"2025-02-22T07:26:48.000Z","dependencies_parsed_at":"2024-01-07T17:11:04.255Z","dependency_job_id":"7c81ec51-45e0-443b-a302-586edbb7307d","html_url":"https://github.com/fcakyon/streamlit-image-comparison","commit_stats":{"total_commits":24,"total_committers":4,"mean_commits":6.0,"dds":"0.16666666666666663","last_synced_commit":"f821bb3a5c2d77758a83313b901a02c24a8848f5"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fstreamlit-image-comparison","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fstreamlit-image-comparison/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fstreamlit-image-comparison/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fstreamlit-image-comparison/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcakyon","download_url":"https://codeload.github.com/fcakyon/streamlit-image-comparison/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190231,"owners_count":20898700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["huggingface","image-slider","machine-learning","pip","pypi","python","streamlit","visualization"],"created_at":"2024-08-03T03:02:17.269Z","updated_at":"2025-04-04T14:09:47.465Z","avatar_url":"https://github.com/fcakyon.png","language":"Python","funding_links":["https://github.com/sponsors/fcakyon"],"categories":["Python"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch2\u003e\n    Streamlit Image Comparison Component\n\u003c/h2\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://badge.fury.io/py/streamlit-image-comparison\"\u003e\u003cimg src=\"https://badge.fury.io/py/streamlit-image-comparison.svg\" alt=\"pypi version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pepy.tech/project/streamlit-image-comparison\"\u003e\u003cimg src=\"https://pepy.tech/badge/streamlit-image-comparison\" alt=\"total downloads\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://huggingface.co/spaces/fcakyon/streamlit-image-comparison\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/fcakyon/streamlit-image-comparison/main/resources/hf_spaces_badge.svg\" alt=\"HuggingFace Spaces\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://twitter.com/fcakyon\"\u003e\u003cimg src=\"https://img.shields.io/badge/twitter-fcakyon_-blue?logo=twitter\u0026style=flat\" alt=\"fcakyon twitter\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\nA simple Streamlit Component to compare images with a slider in Streamlit apps using [Knightlab's JuxtaposeJS](https://juxtapose.knightlab.com/). It accepts images in any format and makes it possible to set all parameters of the JS component via Python. Live demo at [Huggingface Spaces](https://huggingface.co/spaces/fcakyon/streamlit-image-comparison)\n\n\u003cp align=\"center\"\u003e\n\u003ca href='https://huggingface.co/spaces/fcakyon/streamlit-image-comparison' target='_blank'\u003e \u003cimg src=\"https://user-images.githubusercontent.com/34196005/143328163-2976a3b6-91d0-47c5-b872-c92dd6ea404e.gif\" width=\"600\"\u003e\u003c/a\u003e\n\n\u003c/p\u003e\n\n## Installation\n- Install via pip:\n\n```bash\npip install streamlit\npip install streamlit-image-comparison\n```\n\n## Example\n\n```python\n# Streamlit Image-Comparison Component Example\n\nimport streamlit as st\nfrom streamlit_image_comparison import image_comparison\n\n# set page config\nst.set_page_config(page_title=\"Image-Comparison Example\", layout=\"centered\")\n\n# render image-comparison\nimage_comparison(\n    img1=\"image1.jpg\",\n    img2=\"image2.jpg\",\n)\n```\n\n## Supported Image Formats\n\n```python\n\n# image path\nimage = \"image.jpg\"\n\n# image url\nimage = \"https://some-url.com/image.jpg\"\n\n# pil image\nfrom PIL import Image\nimage = Image.open(\"image.jpg\")\n\n# opencv image\nimport cv2\nimage = cv2.cvtColor(cv2.imread(\"image.jpg\"), cv2.COLOR_BGR2RGB)\n\n# render image-comparison\nimage_comparison(\n    img1=image,\n    img2=image,\n)\n```\n\n## Customization\n\n```python\nimage_comparison(\n    img1=\"image1.jpg\",\n    img2=\"image2.jpg\",\n    label1=\"text1\",\n    label2=\"text1\",\n    width=700,\n    starting_position=50,\n    show_labels=True,\n    make_responsive=True,\n    in_memory=True,\n)\n```\n\n## Improvements\n\nWhat is the difference between this repo and [robmarkcole's](https://github.com/robmarkcole/streamlit-image-juxtapose)?\n\n- This is a pypi installable package\n- This does not require the images to be saved under `site-packages/streamlit/static/`\n- This accepts any type of image as input (doesn't have to be present in local)\n- This can utilize all parameters of the JS component\n\n## References\n- https://juxtapose.knightlab.com/\n- https://github.com/robmarkcole/streamlit-image-juxtapose\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcakyon%2Fstreamlit-image-comparison","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcakyon%2Fstreamlit-image-comparison","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcakyon%2Fstreamlit-image-comparison/lists"}