mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 21:24:31 +03:00
Merge pull request #5551 from radarhere/imageops
This commit is contained in:
commit
e5b2d61e00
|
@ -156,6 +156,12 @@ def test_scale():
|
||||||
assert newimg.size == (25, 25)
|
assert newimg.size == (25, 25)
|
||||||
|
|
||||||
|
|
||||||
|
def test_expand_palette():
|
||||||
|
im = Image.open("Tests/images/hopper.gif")
|
||||||
|
im_expanded = ImageOps.expand(im)
|
||||||
|
assert_image_equal(im_expanded.convert("RGB"), im.convert("RGB"))
|
||||||
|
|
||||||
|
|
||||||
def test_colorize_2color():
|
def test_colorize_2color():
|
||||||
# Test the colorizing function with 2-color functionality
|
# Test the colorizing function with 2-color functionality
|
||||||
|
|
||||||
|
|
|
@ -393,6 +393,8 @@ def expand(image, border=0, fill=0):
|
||||||
width = left + image.size[0] + right
|
width = left + image.size[0] + right
|
||||||
height = top + image.size[1] + bottom
|
height = top + image.size[1] + bottom
|
||||||
out = Image.new(image.mode, (width, height), _color(fill, image.mode))
|
out = Image.new(image.mode, (width, height), _color(fill, image.mode))
|
||||||
|
if image.mode == "P" and image.palette:
|
||||||
|
out.putpalette(image.palette)
|
||||||
out.paste(image, (left, top))
|
out.paste(image, (left, top))
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user