Skip to main content

A Python version of Photoshop where users can do simple tasks of photo editing, such as croopping an image, rescaling an image, applying filters to an image, and much more.

Project description

Pythoshop

Pythoshop is a Python package designed to provide a set of handy image processing functions for simple yet effective adjustments to images. Whether you need to tweak brightness, adjust aspect ratios, transform images, or apply filters, Pythoshop has you covered.

Documentation Status Python 3.9.0 License: GPL v3 version release ci-cd codecov Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Functions

  • adjust_brightness(image, brightness_factor, verbose): Adjusts the brightness of an image object in the form of a NumPy array. The brightness_factor parameter allows fine-tuning the brightness level. Returns an updated NumPy array.

  • resize_image(image, height, width, method:, verbose): This function takes a Numpy array image object and adjusts the image to have the inputted dimensions using the selected method. Returns an updated NumPy array.

  • transform_image(image, method, direction, verbose): Transforms a NumPy array image object based on the specified method and direction. Options include "rotate" or "flip", allowing users to orient images as needed. Returns an updated NumPy array.

  • apply_filter(image, method, degree, verbose): Applies a filter to an image object in the form of a NumPy array. Users can choose from filter methods and adjust the degree of filtering to achieve the desired visual effect. Returns an updated NumPy array.

Python Ecosystem Integration

Pythoshop complements existing image processing libraries in the Python ecosystem, offering a lightweight solution for common image adjustments. While other comprehensive libraries like Pillow and OpenCV provide extensive functionalities, Pythoshop focuses on simplicity and ease of use. If you need quick and straightforward image processing without the overhead of more extensive libraries, Pythoshop is the ideal choice.

Related Packages:

  • Pillow: A powerful image processing library in Python, providing comprehensive features for image manipulation and editing.

  • OpenCV: An open-source computer vision and machine learning library, suitable for complex image processing tasks and computer vision applications.

Installation

This package is currently under development. Hence the installation instructions are as below. First, you need to make sure you have installed conda and poetry.

To install Anaconda:

  1. Download the Anaconda Installer:
  • Visit the Anaconda Download page
  • Choose the installer for your operating system (Windows, macOS, or Linux).
  • Select the version for Python 3.x.
  1. Run the Installer:
  • Windows: Open the downloaded .exe file and follow the instructions. It's recommended to check the option to "Add Anaconda to my PATH environment variable" for easy use in the command prompt, but be aware this can interfere with other software.
  • macOS or Linux: Open Terminal, navigate to the directory containing the downloaded script, and run it with bash Anaconda3-xxxxxx.sh, following the on-screen instructions.
  1. Verify Installation: Open your command line interface (CLI) and type conda list. If Anaconda is installed properly, you should see a list of installed packages.

To install poetry, follow the instructions below:

We recommend installing Poetry using their official installer while referring to their official poetry documentation for detailed installation instructions and support. (You will be installing poetry in your base environment, make sure to add poetry to system path on windows)

Now navigate to the folder where you want to download the pythoshop package.

# 1. clone the repo
$ git clone git@github.com:UBC-MDS/Pythoshop.git
# 2. create virtual environment
$ conda create --name pythoshop python=3.9 -y
$ conda activate pythoshop
# 3. install the package at the command line from the root package directory:
$ poetry install

In the future Once this package is published on PyPi, the package will be available for installation via:

pip install pythoshop

Usage

To unleash the power of Pythoshop, follow the simple steps below:

  1. Load the functions from Pythoshop
from pythoshop import adjust_brightness, resize_image, transform_image, apply_filter
  1. Make sure you assign the images you need to transform in the form of NumPy arrays.
  2. Now, You can process your images, below is an example of one how you can change the brightness of your image:

Adjust Brightness

from pythoshop import adjust_brightness, resize_image, transform_image, apply_filter
import matplotlib.image as mpimg

# Replace the path with the actual path you are saving your image
image = mpimg.imread('path/to/input_image.jpg') 
brightness_factor = 20  # Adjust as needed

adjust_brightness.adjust_brightness(image, brightness_factor)

For further details on how you can use the other 3 functions, please refer to the docs linked here.

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

Contributors

Salva Umar, Jenny Lee, Ella Hein, Runtian (Rachel) Li

License

Pythoshop was created by Salva Umar, Jenny Lee, Ella Hein, Rachel Li. It is licensed under the terms of the GNU GPLv3 license.

Credits

pythoshop was created with cookiecutter and the py-pkgs-cookiecutter template.

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

pythoshop-3.2.22.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

pythoshop-3.2.22-py3-none-any.whl (8.7 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