Commit 4d7f70b5 authored by Sasank Chilamkurthy's avatar Sasank Chilamkurthy
Browse files

scale change to (h, w) ordering. (based on #256)

parent 538d87b1
...@@ -144,7 +144,7 @@ def scale(img, size, interpolation=Image.BILINEAR): ...@@ -144,7 +144,7 @@ def scale(img, size, interpolation=Image.BILINEAR):
Args: Args:
img (PIL.Image): Image to be scaled. img (PIL.Image): Image to be scaled.
size (sequence or int): Desired output size. If size is a sequence like size (sequence or int): Desired output size. If size is a sequence like
(w, h), output size will be matched to this. If size is an int, (h, w), output size will be matched to this. If size is an int,
smaller edge of the image will be matched to this number. smaller edge of the image will be matched to this number.
i.e, if height > width, then image will be rescaled to i.e, if height > width, then image will be rescaled to
(size * height / width, size) (size * height / width, size)
...@@ -172,7 +172,7 @@ def scale(img, size, interpolation=Image.BILINEAR): ...@@ -172,7 +172,7 @@ def scale(img, size, interpolation=Image.BILINEAR):
ow = int(size * w / h) ow = int(size * w / h)
return img.resize((ow, oh), interpolation) return img.resize((ow, oh), interpolation)
else: else:
return img.resize(size, interpolation) return img.resize(size[::-1], interpolation)
def pad(img, padding, fill=0): def pad(img, padding, fill=0):
...@@ -355,7 +355,7 @@ class Scale(object): ...@@ -355,7 +355,7 @@ class Scale(object):
Args: Args:
size (sequence or int): Desired output size. If size is a sequence like size (sequence or int): Desired output size. If size is a sequence like
(w, h), output size will be matched to this. If size is an int, (h, w), output size will be matched to this. If size is an int,
smaller edge of the image will be matched to this number. smaller edge of the image will be matched to this number.
i.e, if height > width, then image will be rescaled to i.e, if height > width, then image will be rescaled to
(size * height / width, size) (size * height / width, size)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment