pythoshop.adjust_brightness
Module Contents
Functions
|
Adjust the brightness of an image and save the result. |
- pythoshop.adjust_brightness.adjust_brightness(img, brightness_factor, verbose=False)[source]
Adjust the brightness of an image and save the result.
This function changes the brightness of an input image by a specified factor. The factor can be positive to increase brightness or negative to decrease it. The brightness change is applied uniformly to all pixels of the image.
- Parameters:
image_path (str) – The file path to the image that needs brightness adjustment. The image can be in .jpg or .png format.
brightness_factor (int or float) – A value that determines the amount by which to adjust the brightness. Positive values increase brightness, while negative values decrease it.
- Returns:
The adjusted image is saved as a .png file at the same location as the input with “_brightened” appended to the original filename.
- Return type:
None
- Raises:
IOError – If the image file cannot be opened or saved.
Example: –
>>> img = mpimg.imread("tests/test_img_1.png") –
>>> img_adjusted = adjust_brightness(img, -0.3) –