Premultiply RGBA images prior to transform and resize and undo after

This commit is contained in:
wiredfool 2013-10-04 13:25:32 -07:00
parent b9f94b7632
commit 10214bc6c4

View File

@ -1309,6 +1309,9 @@ class Image:
if self.mode in ("1", "P"):
resample = NEAREST
if self.mode == 'RGBA':
return self.convert('RGBa').resize(size, resample).convert('RGBA')
if resample == ANTIALIAS:
# requires stretch support (imToolkit & PIL 1.1.3)
try:
@ -1606,6 +1609,9 @@ class Image:
:returns: An Image object.
"""
if self.mode == 'RGBA':
return self.convert('RGBa').transform(size, method, data, resample, fill).convert('RGBA')
if isinstance(method, ImageTransformHandler):
return method.transform(size, self, resample=resample, fill=fill)
if hasattr(method, "getdata"):
@ -1613,6 +1619,7 @@ class Image:
method, data = method.getdata()
if data is None:
raise ValueError("missing method data")
im = new(self.mode, size, None)
if method == MESH:
# list of quads