hflip

paddle.vision.transforms. hflip ( img ) [source]

Horizontally flips the given Image or np.array.

Parameters

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

Returns

Horizontall flipped image.

Return type

PIL.Image or np.array

Examples

import numpy as np
from PIL import Image
from paddle.vision.transforms import functional as F

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

fake_img = Image.fromarray(fake_img)

flpped_img = F.hflip(fake_img)
print(flpped_img.size)