adjust_brightness adjust_brightness ( img, brightness_factor ) [source]

Adjusts brightness of an Image.

  • img (PIL.Image|np.array) – Image to be adjusted.

  • brightness_factor (float) – How much to adjust the brightness. Can be any non negative number. 0 gives a black image, 1 gives the original image while 2 increases the brightness by a factor of 2.


Brightness adjusted image.

Return type

PIL.Image or np.array


import numpy as np
from PIL import Image
from import functional as F

fake_img = (np.random.rand(256, 300, 3) * 255.).astype('uint8')

fake_img = Image.fromarray(fake_img)

converted_img = F.adjust_brightness(fake_img, 0.4)