Skip to main content

Performs simple image modifications

Project description

ImageModifier

GitHub issues GitHub last commit GitHub release Documentation Status codecov

Created by DALL·E

Created by DALL.E

ImageModifier is a Python package dedicated to providing an intuitive and efficient way to manipulate JPEG images. This package focuses on core JPEG image processing functions, allowing users to easily modify images through operations like rotating, slicing, adding frame, and adjusting RGB channels. The primary goal is to offer a straightforward way for basic yet powerful JPEG image transformations, making it a useful tool for image processing.

Contributors

Chun Li, Celeste Zhao, He Ma, Karan Khubdikar

Motivation

ImageModifier offers a streamlined and intuitive approach, making it highly accessible to a wide range of users, unlike many complex image processing tools that can be overwhelming for beginners and cumbersome for quick tasks. This package caters to both novices seeking an easy entry point into image manipulation and experienced users looking for a tool to perform quick modifications without the overhead of more complex software. With core functionalities like rotating, slicing, adding frames, and selecting RGB channels, ImageModifier simplifies these common tasks, allowing users to achieve their goals with minimal coding effort.

Functions

rotate_90: Rotating an image by 90 degrees clockwise.

add_frame: Adding a frame to an image.

select_channel: Modifying an image with/without a specified RGB channel.

slice_image: Slicing an image into a specified number of horizontal and vertical slices.

Documentation

The package documentation, including installation instructions, usage examples and API details, is available on ReadTheDocs and accessible here.

Installation

For user

Installing the package

$ pip install image_modifier

For developer

Setting up the project

Clone the repository to your local machine:

$ git clone https://github.com/UBC-MDS/image_modifier
$ cd image_modifier/

Create and activate the virtual environment:

$ conda env create -f image_modifier.yml
$ conda activate image_modifier

Install the packages via poetry:

$ poetry install

Running unit tests

To run unit tests to ensure the functionality of the modifications, execute:

$ poetry run pytest

To include code coverage reporting, can also run:

$ poetry run pytest --cov=image_modifier

Usage

Importing libraries and image

The following code can be used to import libraries and an image in python.

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from PIL import Image

>>> image = Image.open("src/ubc.jpeg")  # Example for demonstration
>>> image_ary = np.array(image)

Function usage

Rotate the image by 90 degree clockwise

>>> from image_modifier.rotate_90 import rotate_90

>>> rotated_image = rotate_90(image_ary)
>>> plt.imshow(rotated_image)

Add frame to the image

>>> from image_modifier.add_frame import add_frame

>>> framed_image = add_frame(image_ary, border_size=30, color_name='blue', overlay=True)
>>> plt.imshow(framed_image)

Select color channel

>>> from image_modifier.select_channel import select_channel

>>> colored_image = select_channel(image_ary, 'r')
>>> plt.imshow(colored_image)

Slice the image

>>> from image_modifier.slice_image import slice_image

>>> slices = slice_image(image_ary, horizontal_slices=2, vertical_slices=2)

Usage examples

Detailed usage examples can be found here.

Position within the Python ecosystem

ImageModifier bridges the gap between highly complex image processing libraries and the need for straightforward, user-friendly JPEG image manipulation tools. Its focus on core image processing functionalities—such as rotating, slicing, adding frames, and adjusting RGB channels. While Python boasts powerful image processing libraries like OpenCV and PIL/Pillow, these can often be overwhelming for beginners or overkill for simple tasks. ImageModifier's simplicity makes it an attractive starting point for newcomers to JPEG image processing, as well as a quick and efficient tool for experienced users needing to perform routine tasks without the overhead of more complex libraries.

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.

License

image_modifier was created by Karan Khubdikar, Celeste Zhao, He Ma, Chun Li. It is licensed under the terms of the MIT license, and more details can be found in the LICENSE.

Credits

image_modifier 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

image_modifier-2.0.9.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

image_modifier-2.0.9-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file image_modifier-2.0.9.tar.gz.

File metadata

  • Download URL: image_modifier-2.0.9.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for image_modifier-2.0.9.tar.gz
Algorithm Hash digest
SHA256 81ad9fc441b9c2e5dcd486c7b31f561042d191f7865b0f389827a9198fdff1a5
MD5 73ae4d03b9b89dc7ee5d46ca862dd444
BLAKE2b-256 63523b76731fe7e21bf77fe9edc056ef2f6ca37ab86a65ecfce2a44abc5cf15a

See more details on using hashes here.

File details

Details for the file image_modifier-2.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for image_modifier-2.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 7d8c5c9a981cb979398e9b14f4575152d80a0f43bf3c63bb0e67590e824cd42b
MD5 5cf8f653f06fd770bdb7d447ee44f452
BLAKE2b-256 50ae590e146a38f932a66b0254f07e2badc255234552571f8cf32efcb6eb758e

See more details on using hashes here.

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