Skip to main content

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 images. This package focuses on core 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 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.

Installation

$ pip install image_modifier

Usage

Setting up the Project

Clone the repository to your local machine:

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

Create the environment:

$ conda env create -f image_modifier.yml

Activate the virtual environment:

$ conda activate image_modifier

Install the packages via poetry:

$ poetry install

Run 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

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

image_modifier has four functions to modify an image.

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)

Documentation

Online documentation and tutorial can be found 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.

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.

Metadata

Release files for image-modifier 2.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for image-modifier 2.0.4
File Size Uploaded Provenance Actions
image_modifier-2.0.4.tar.gz 9.3 kB Without provenance Details for image_modifier-2.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for image-modifier 2.0.4
File Interpreter ABI Platform Actions
image_modifier-2.0.4-py3-none-any.whl Python 3 none any Details for image_modifier-2.0.4-py3-none-any.whl

Total release size: 18.6 kB

Release files / image_modifier-2.0.4.tar.gz

Download URL image_modifier-2.0.4.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
44b655d4a6922b54f68950a17ceccbf6d76ee7e4eb3300180814d36c893f1480
BLAKE2b-256 checksum
How to use checksums
22d56e81f25fed527a9dac8243102cc27bc23c41500a5f66a3c12f8a68608a8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / image_modifier-2.0.4-py3-none-any.whl

Download URL image_modifier-2.0.4-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f64161934be8aa24b1e0f03233c849b747637a93a55b1c6ac7e747811c8efe5
BLAKE2b-256 checksum
How to use checksums
11cbad6beb0ffe77f67267578640d01dc4b574902fb38d491d7a77e873a97ad5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for image-modifier 2.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page