Skip to main content

An image modification package.

Project description

iModif

imodif is an image brightness modifier. This module is mainly meant to reduce or increase the brightness of images. It either brightens, darkens or dims images and uses libraries like numpy and opencv., hence ensure these packages are installed alongside imodif. Github documentation.

Why?

I built this module because I needed a package, module or function that could help me darken my images to simulate night time but I didn't seem to find anything simple enough to meet my need. Everything was so complex with a lot of complicated mathematics. Nothing really fit what I wanted to do with my images so I had to build one to do it and perhaps help anyone out there with a similar need to mine.

Installation

You can install imod from PyPi or using python pip installer

pip install imodif

Importing

Importing the package modules is as follows

from imodif import dark, dim, bright

How to use

img_path = r"C:\Users\malon\Desktop\assests\Stlogo.png"

dark.dark(img_path, degree=9, show=True, show_original=True)
img_path = r"C:\Users\malon\Desktop\assests\Stlogo.png"

bright.bright(img_path, degree=9, show=True, show_original=True)
img_path = r"C:\Users\malon\Desktop\assests\Stlogo.png"

dim.dim(img_path, degree=9, show=True, show_original=True)

Other methods include

dark.dark_to_folder(_parameters_)
bright.bright_to_folder(_parameters_)
dim.dim_to_folder(_parameters_)

NB: Press 0 on your keyboard to close opened images.

imodif is really simple to use. There are basically just 6 methods you'll be calling. First three is dark, bright and dim. These methods have the following parameters.

image(required): The image you wish to brighten. This should be the absolute path to the image.

degree: The degree of darkness you want. Values range from 1 to 15 with 1=lowest darkness and 15(10 for the dim method)=highest darkness. Default is set to 1.

show: True to show the modified image using cv2.imshow, False to not show modified image. Defaults to False.

show_original: True to show original image alonside modified image, False to not show original image but modified only. Defaults to False.

The first three methods take a single image and returns the modified numpy array or image based on the parameters set. This helps give a fair idea on what images will look like before applying them on multiple images which the next three handles.

The next dark_to_folder, dim_to_folder and bright_to_folder take the path or directory of a folder containing images, applies the required modification to the images and saves them in a new folder specified in the parameter 'folder_name'. Dafault name is "modified. The following parameters can be set for these methods.

images_path(required): The absolute path of the folder containing the images.

file_extension(required): The extension name of the files in the folder, eg. jpg, png etc.... Must be a string value.

folder_name: Name of the newly created folder that contains the modified images. Defaults to 'modified'.

lowest_degree: The least value of degree of modification to apply to the images. Defaults to 1.

highest_degree: The highest value of degree of modification to apply to the images. Defaults to 5. Limit is 15(10 for dim_to_folder).

add_original: True to add original images to modified ones in the folder, False to not. Defaults to False.

fperc: Percentage of images in the folder to modify. Range between 0 to 1.

shuffle: True to shuffle up the modified and original images in the folder, False to not. Defaults to False.

The lowest and highest degree parameters are used to setup a range that applies random degrees of modifications to the images, hence all the images do not have the same degree of modification i.e., brightness, darkness or dimness. With this there is no need to manually apply dark, bright, dim filters to images one by one. You get to apply these filters to bulk images at the same time with varying degrees of contrast.

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

imodif-1.0.4.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imodif-1.0.4-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file imodif-1.0.4.tar.gz.

File metadata

  • Download URL: imodif-1.0.4.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for imodif-1.0.4.tar.gz
Algorithm Hash digest
SHA256 6969d723df500bd67ac78166768a29cab84fa79b769aeb7715d1b58893ad79ee
MD5 7341e79f5b17e0af00f0fdee66b98498
BLAKE2b-256 8ad0453c84697978d2a2fe153053a46ef66fcf056f7133d54e0b1c4bbeb18332

See more details on using hashes here.

File details

Details for the file imodif-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: imodif-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for imodif-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 74071a8211d89aba16f6c642b3a7760be7208b9b3781ba2dacd28b76a387a78e
MD5 0249ffc5402e95108f7f6c05c6eb558e
BLAKE2b-256 d108390c0806b050b725e2e80a7a77b5b955512d0372d62bcdbc16e727a2f03b

See more details on using hashes here.

Supported by

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