Commit 6a8380cf authored by Hang Su's avatar Hang Su Committed by Soumith Chintala
Browse files

allow Pad to take non-number color formats (#69)

Previous assertion only allows numbers for `fill`, which rules out the possibility to pad multi-channel colors. For example, now fill=(255,255,255) or fill="white" can be used to achieve white padding for rgb inputs.
parent f7c78114
...@@ -135,7 +135,7 @@ class Pad(object): ...@@ -135,7 +135,7 @@ class Pad(object):
"""Pads the given PIL.Image on all sides with the given "pad" value""" """Pads the given PIL.Image on all sides with the given "pad" value"""
def __init__(self, padding, fill=0): def __init__(self, padding, fill=0):
assert isinstance(padding, numbers.Number) assert isinstance(padding, numbers.Number)
assert isinstance(fill, numbers.Number) assert isinstance(fill, numbers.Number) or isinstance(fill, str) or isinstance(fill, tuple)
self.padding = padding self.padding = padding
self.fill = fill self.fill = fill
......
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