Skip to main content

A lightweight image processing library

Project description

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

IStacky

A lightweight image processing library
Explore the docs »

View Example · Report Bug · Request Feature


:books: About The Project

Usage of istacky

IStacky is a lightweight image processing library based on the Ipywidgets library and designed to be used in Jupyter Notebooks. The main idea is to provide a simple and intuitive interface to stack images and apply number of modifications to them, such as cropping, resizing or background removal.

This project has been made to be used in the context of machine learning and computer vision projects, where the user needs to quickly and easily create output images that combines several images: plots, photos, logos etc.

(back to top)

:technologist: Installation

:arrow_heading_down: (coming soon) using pip

pip install istacky # not working yet!

:twisted_rightwards_arrows: install and run from source code

Clone the repo, create a virtual environment and install using pip:

git clone https://github.com/antoineedy/istacky.git
cd istacky
python3 -m venv .
source bin/activate
pip install -e .

(back to top)

:mag_right: Usage

Istacky is meant to be used in Jupyter Notebooks. Do not foregt to have a look at the documentation for more details!

:video_camera: Tutorial (coming soon)

:notebook: Example

Have a look at the example notebook for a complete example.

Import the libraries needed:

from PIL import Image
import istacky

Load the images we want to stack:

background = Image.open("image/background.png")
img1 = Image.open("image/img1.png")
img2 = Image.open("image/img2.png")

Create a BlendedImage object and display it:

blended = istacky.BlendedImage(background, [img1, img2])
blended.show()

First output

The images are just stacked on top of each other! Let's apply some modifications to them:

blended.editor()

Editor

Calling editor displays a widget that allows you to apply modifications to the images. You can crop, resize, change the opacity, remove the background, add images, change the orders of the layers etc.

In our case, we want to put the logo in one corner, circle the pisition of the ball and add a plot of the trajectory of the ball. After the changes, here is the final result:

blended.show()

Final output

Now, if we want to apply the same modifications to another image, we can have access to the code that was used to create the final image, and apply it to another one:

my_code = blended.get_code()

We will use the same background, but different images:

new_img1 = Image.open("image/new_img1.png")
new_img2 = Image.open("image/new_img2.png")
new_img3 = Image.open("image/new_img3.png")

We specify the code that was used to create the first image, and apply it to the new images:

new_blended = istacky.BlendedImage(
    background=background,
    images = [new_img1, new_img2, new_img3],
    code=my_code
    )
    
new_blended.show()

Final output

We can see that the modifications have been applied to the new images!

(back to top)

:gear: GUI options

Widget Function Values
Logo Switch between layers $l \in ⟦1, N_{images}⟧$
Logo Reposition the image ($x$ and $y$ coordinates) $x \in [-I_{w}, Bg_{w} + I{w}]$
$y \in [-Y_{h}, Bg_{h} + I_{h}]$
Logo Change the opacity of the selected layer $o\in[0, 1]$
Logo Remove one color of the selected layer $[r, g, b] \in ⟦0, 255⟧^3$
Logo How close the removed colors must be from the selected color $t\in[0, 100]$
Logo The height of the selected image in % of the background height $s\in]0, 2]$
Logo Percentage of the selected image cropped in all 4 directions, and reseting the crop $c\in[0, 100]$
Logo Show the selected layer in the final image $s\in{True, False}$
Logo Crop or expand the background image (in pixels) in all 4 directions $c\in \mathbb{Z}$
Logo Reset the cropping of the background
Logo Copy the code of the current output to the clipboard
Logo Make a red border appear on the selected layer for editing purposes (does not appear on the final output) $v\in{True, False}$
Logo Set the size of the image displayed in pixels to fit all screen sizes (does not change the output size) $d\in]0, 1000]$
Logo Upload a new image to stack. Creates a new layer.
Logo To choose the new image to add from the user's computer. Made with ipyfilechooser

:world_map: Future of the project

I wonder if I (we?) should extend this project to create a Photoshop-like interface using the ipywidgets library. I really don't know any use to this project. Let me know if you have any ideas! See the open issues for a full list of proposed features (and known issues).

(back to top)

:family_man_woman_girl_boy: Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

:scroll: License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

:dart: Contact

My name is Antoine EDY. Here is my LinkedIn and my Github profiles, and you can send me an email to antoineedy@outlook.fr.

(back to top)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

istacky-0.1.0.tar.gz (13.5 MB view hashes)

Uploaded Source

Built Distribution

istacky-0.1.0-py3-none-any.whl (13.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page