adjust_brightness¶
- paddle.vision.transforms. adjust_brightness ( img, brightness_factor ) [source]
-
Adjusts brightness of an Image.
- Parameters
-
img (PIL.Image|np.array|paddle.Tensor) – 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.
- Returns
-
Brightness adjusted image.
- Return type
-
PIL.Image|np.array|paddle.Tensor
Examples
>>> import numpy as np >>> from PIL import Image >>> from paddle.vision.transforms import functional as F >>> np.random.seed(2023) >>> fake_img = (np.random.rand(256, 300, 3) * 255.).astype('uint8') >>> fake_img = Image.fromarray(fake_img) >>> print(fake_img.size) (300, 256) >>> print(fake_img.load()[1,1]) (61, 155, 171) >>> converted_img = F.adjust_brightness(fake_img, 0.5) >>> print(converted_img.size) (300, 256) >>> print(converted_img.load()[1,1]) (30, 77, 85)