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.

randomize: True to mix 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.3.tar.gz (7.3 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.3-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: imodif-1.0.3.tar.gz
  • Upload date:
  • Size: 7.3 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.3.tar.gz
Algorithm Hash digest
SHA256 64e91b98479444e40bafce03c56764684b0c499939e8332b3bbb2e331e6a0707
MD5 1049488ec5d813ef1088f18890117a2b
BLAKE2b-256 34e44abdf8f956f13a3e75783f686db95741cba48c96e0f45121264e27bb84b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: imodif-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3e27858ca121535614f1b0a4daf665b254d70ac557c0f74084d64fbeebccade1
MD5 d3caae3974f66f928d87e49033adf3a4
BLAKE2b-256 4cf843484d2037f9f5f0527ac9f1c5528042bce5206d19f03377cdabb518e102

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