MCPcopy Create free account
hub / github.com/ChenWu98/cycle-diffusion / CenterCropLongEdge

Class CenterCropLongEdge

utils/transform_utils.py:4–22  ·  view source on GitHub ↗

Crops the given PIL Image on the long edge. Args: size (sequence or int): Desired output size of the crop. If size is an int instead of sequence like (h, w), a square crop (size, size) is made.

Source from the content-addressed store, hash-verified

2
3
4class CenterCropLongEdge(object):
5 """Crops the given PIL Image on the long edge.
6 Args:
7 size (sequence or int): Desired output size of the crop. If size is an
8 int instead of sequence like (h, w), a square crop (size, size) is
9 made.
10 """
11
12 def __call__(self, img):
13 """
14 Args:
15 img (PIL Image): Image to be cropped.
16 Returns:
17 PIL Image: Cropped image.
18 """
19 return TF.center_crop(img, min(img.size))
20
21 def __repr__(self):
22 return self.__class__.__name__
23
24

Callers 2

__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected