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.

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.

imod 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.21.tar.gz (7.3 kB view details)

Uploaded Source

Built Distributions

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

imodif-1.0.21-py3.10.egg (13.9 kB view details)

Uploaded Egg

imodif-1.0.21-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: imodif-1.0.21.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.21.tar.gz
Algorithm Hash digest
SHA256 c7b7cb216041f220886694b90916e56931e75f5096f913ca6c8fe6e534065180
MD5 965bc2f44815cf00eb4580ea57f1d518
BLAKE2b-256 9a932ed92d3c59c3878ae17342abbfa5cf2e103fa530b54cb06616df4b3f0aff

See more details on using hashes here.

File details

Details for the file imodif-1.0.21-py3.10.egg.

File metadata

  • Download URL: imodif-1.0.21-py3.10.egg
  • Upload date:
  • Size: 13.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for imodif-1.0.21-py3.10.egg
Algorithm Hash digest
SHA256 d667bd62b4c59396086a613fee0e0d292ac919680aed277ab69ca572d93922bd
MD5 8ecf359b173bd4b8f08c71ee8c61c4d5
BLAKE2b-256 34f676b2e4fcc6891ff7e02f0dc701f8f37ba441369a2089356501424b835c10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: imodif-1.0.21-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.21-py3-none-any.whl
Algorithm Hash digest
SHA256 eed0b3f28b144a421cfde98a3f2267402ee2dca69954377496426b54aa954a97
MD5 a5c7dff7482897314f0fb262a12d903a
BLAKE2b-256 6b42deb6bee4aeaee34599050ac911ebf74450453f176e610884b15817d20cc1

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