mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 09:56:17 +03:00
Deprecate ImageOps undocumented functions
This commit is contained in:
parent
3b5c2c30be
commit
d5f069472d
|
@ -21,6 +21,7 @@ from . import Image
|
|||
from ._util import isStringType
|
||||
import operator
|
||||
import functools
|
||||
import warnings
|
||||
|
||||
|
||||
#
|
||||
|
@ -437,6 +438,13 @@ def solarize(image, threshold=128):
|
|||
def gaussian_blur(im, radius=None):
|
||||
""" PIL_usm.gblur(im, [radius])"""
|
||||
|
||||
warnings.warn(
|
||||
'PIL.ImageOps.gaussian_blur is deprecated. '
|
||||
'Use PIL.ImageFilter.GaussianBlur instead. '
|
||||
'This function will be removed in a future version.',
|
||||
DeprecationWarning
|
||||
)
|
||||
|
||||
if radius is None:
|
||||
radius = 5.0
|
||||
|
||||
|
@ -444,12 +452,30 @@ def gaussian_blur(im, radius=None):
|
|||
|
||||
return im.im.gaussian_blur(radius)
|
||||
|
||||
gblur = gaussian_blur
|
||||
|
||||
def gblur(im, radius=None):
|
||||
""" PIL_usm.gblur(im, [radius])"""
|
||||
|
||||
warnings.warn(
|
||||
'PIL.ImageOps.gblur is deprecated. '
|
||||
'Use PIL.ImageFilter.GaussianBlur instead. '
|
||||
'This function will be removed in a future version.',
|
||||
DeprecationWarning
|
||||
)
|
||||
|
||||
return gaussian_blur(im, radius)
|
||||
|
||||
|
||||
def unsharp_mask(im, radius=None, percent=None, threshold=None):
|
||||
""" PIL_usm.usm(im, [radius, percent, threshold])"""
|
||||
|
||||
warnings.warn(
|
||||
'PIL.ImageOps.unsharp_mask is deprecated. '
|
||||
'Use PIL.ImageFilter.UnsharpMask instead. '
|
||||
'This function will be removed in a future version.',
|
||||
DeprecationWarning
|
||||
)
|
||||
|
||||
if radius is None:
|
||||
radius = 5.0
|
||||
if percent is None:
|
||||
|
@ -461,7 +487,18 @@ def unsharp_mask(im, radius=None, percent=None, threshold=None):
|
|||
|
||||
return im.im.unsharp_mask(radius, percent, threshold)
|
||||
|
||||
usm = unsharp_mask
|
||||
|
||||
def usm(im, radius=None, percent=None, threshold=None):
|
||||
""" PIL_usm.usm(im, [radius, percent, threshold])"""
|
||||
|
||||
warnings.warn(
|
||||
'PIL.ImageOps.usm is deprecated. '
|
||||
'Use PIL.ImageFilter.UnsharpMask instead. '
|
||||
'This function will be removed in a future version.',
|
||||
DeprecationWarning
|
||||
)
|
||||
|
||||
return unsharp_mask(im, radius, percent, threshold)
|
||||
|
||||
|
||||
def box_blur(image, radius):
|
||||
|
@ -478,6 +515,13 @@ def box_blur(image, radius):
|
|||
in each direction, i.e. 9 pixels in total.
|
||||
:return: An image.
|
||||
"""
|
||||
warnings.warn(
|
||||
'PIL.ImageOps.box_blur is deprecated. '
|
||||
'Use PIL.ImageFilter.BoxBlur instead. '
|
||||
'This function will be removed in a future version.',
|
||||
DeprecationWarning
|
||||
)
|
||||
|
||||
image.load()
|
||||
|
||||
return image._new(image.im.box_blur(radius))
|
||||
|
|
Loading…
Reference in New Issue
Block a user