Package: image-modifier
ImageModifierCreated by DALL.EImageModifier 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.ContributorsChun Li, Celeste Zhao, He Ma, Karan KhubdikarMotivationImageModifier 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.Functionsrotate_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.DocumentationThe package documentation, including installation instructions, usage examples and API details, is available on ReadTheDocs and accessiblehere.InstallationFor userInstalling the package$pipinstallimage_modifierFor developerSetting up the projectClone the repository to your local machine:$gitclonehttps://github.com/UBC-MDS/image_modifier
$cdimage_modifier/Create and activate the virtual environment:$condaenvcreate-fimage_modifier.yml
$condaactivateimage_modifierInstall the packages via poetry:$poetryinstallRunning unit testsTo run unit tests to ensure the functionality of the modifications, execute:$poetryrunpytestTo include code coverage reporting, can also run:$poetryrunpytest--cov=image_modifierUsageImporting libraries and imageThe following code can be used to import libraries and an image in python.>>>importnumpyasnp
>>>importmatplotlib.pyplotasplt
>>>fromPILimportImage

>>>image=Image.open("src/ubc.jpeg")# Example for demonstration>>>image_ary=np.array(image)Function usageRotate the image by 90 degree clockwise>>>fromimage_modifier.rotate_90importrotate_90

>>>rotated_image=rotate_90(image_ary)>>>plt.imshow(rotated_image)Add frame to the image>>>fromimage_modifier.add_frameimportadd_frame

>>>framed_image=add_frame(image_ary,border_size=30,color_name='blue',overlay=True)>>>plt.imshow(framed_image)Select color channel>>>fromimage_modifier.select_channelimportselect_channel

>>>colored_image=select_channel(image_ary,'r')>>>plt.imshow(colored_image)Slice the image>>>fromimage_modifier.slice_imageimportslice_image

>>>slices=slice_image(image_ary,horizontal_slices=2,vertical_slices=2)Usage examplesDetailed usage examples can be foundhere.Position within the Python ecosystemImageModifier 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 likeOpenCVandPIL/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.ContributingInterested in contributing? Check out thecontributing guidelines. Please note that this project is released with aCode of Conduct. By contributing to this project, you agree to abide by its terms.Licenseimage_modifierwas 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 theLICENSE.Creditsimage_modifierwas created withcookiecutterand thepy-pkgs-cookiecuttertemplate.