Skip to content

Releases: fcakyon/streamlit-image-comparison

v0.0.4

14 Mar 14:25
235d422
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 0.0.3...0.0.4

v0.0.3

12 Dec 18:09
b755600
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 0.0.2...0.0.3

v0.0.2

01 Dec 17:22
c062a52
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.0.1...0.0.2

v0.0.1

25 Nov 08:46
Compare
Choose a tag to compare

initial release (v0.0.1)

A simple Streamlit Component to compare images with a slider in Streamlit apps using Knightlab's JuxtaposeJS. It accepts images in any format and makes it possible to set all parameters of the JS component via Python. Try it on ...

Installation

  • Install via pip:
pip install streamlit
pip install streamlit-image-comparison

Example

# Streamlit Image-Comparison Component Example

import streamlit as st
from streamlit_image_comparison import image_comparison

# set page config
st.set_page_config(page_title="Image-Comparison Example", layout="centered")

# render image-comparison
image_comparison(
    img1="image1.jpg",
    img2="image2.jpg",
)

Supported Image Formats

# image path
image = "image.jpg"

# image url
image = "https://some-url.com/image.jpg"

# pil image
from PIL import Image
image = Image.open("image.jpg")

# opencv image
import cv2
image = cv2.cvtColor(cv2.imread("image.jpg"), cv2.COLOR_BGR2RGB)

# render image-comparison
image_comparison(
    img1=image,
    img2=image,
)

Customization

image_comparison(
    img1="image1.jpg",
    img2="image2.jpg",
    label1="text1",
    label2="text1",
    width=700,
    starting_position=50,
    show_labels=True,
    make_responsive=True,
    in_memory=True,
)