本文整理匯總了Python中PIL.Image.NONE屬性的典型用法代碼示例。如果您正苦於以下問題:Python Image.NONE屬性的具體用法?Python Image.NONE怎麽用?Python Image.NONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類PIL.Image
的用法示例。
在下文中一共展示了Image.NONE屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import NONE [as 別名]
def __init__(self, interpolation):
if Image is None:
raise ImportError(
'pillow backend for resize operation requires TensorFlow. Please install it before usage.'
)
self._supported_interpolations = {
'NEAREST': Image.NEAREST,
'NONE': Image.NONE,
'BILINEAR': Image.BILINEAR,
'LINEAR': Image.LINEAR,
'BICUBIC': Image.BICUBIC,
'CUBIC': Image.CUBIC,
'ANTIALIAS': Image.ANTIALIAS,
}
try:
optional_interpolations = {
'BOX': Image.BOX,
'LANCZOS': Image.LANCZOS,
'HAMMING': Image.HAMMING,
}
self._supported_interpolations.update(optional_interpolations)
except AttributeError:
pass
super().__init__(interpolation)
示例2: supported_interpolations
# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import NONE [as 別名]
def supported_interpolations(cls):
if Image is None:
return {}
intrp = {
'NEAREST': Image.NEAREST,
'NONE': Image.NONE,
'BILINEAR': Image.BILINEAR,
'LINEAR': Image.LINEAR,
'BICUBIC': Image.BICUBIC,
'CUBIC': Image.CUBIC,
'ANTIALIAS': Image.ANTIALIAS
}
try:
optional_interpolations = {
'BOX': Image.BOX,
'LANCZOS': Image.LANCZOS,
'HAMMING': Image.HAMMING,
}
intrp.update(optional_interpolations)
except AttributeError:
pass
return intrp
示例3: apply_thumbnail_effects
# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import NONE [as 別名]
def apply_thumbnail_effects(image, palette, dither):
'''Apply effects on the reduced image before Legofying'''
palette_image = Image.new("P", (1, 1))
palette_image.putpalette(palette)
return image.im.convert("P",
Image.FLOYDSTEINBERG if dither else Image.NONE,
palette_image.im)
示例4: _convert2pilp
# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import NONE [as 別名]
def _convert2pilp(im):
Image = _getImage()
return im.convert("P", dither=Image.NONE, palette=Image.ADAPTIVE)
示例5: drawToPILP
# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import NONE [as 別名]
def drawToPILP(d, dpi=72, bg=0xffffff, configPIL=None, showBoundary=rl_config._unset_):
Image = _getImage()
im = drawToPIL(d, dpi=dpi, bg=bg, configPIL=configPIL, showBoundary=showBoundary)
return im.convert("P", dither=Image.NONE, palette=Image.ADAPTIVE)
示例6: imageToVector
# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import NONE [as 別名]
def imageToVector(image):
'''
Returns a bit vector representation (list of ints) of a PIL image.
'''
# Convert the image to black and white
image = image.convert('1',dither=Image.NONE)
# Pull out the data, turn that into a list, then a numpy array,
# then convert from 0 255 space to binary with a threshold.
# Finally cast the values into a type CPP likes
vector = (numpy.array(list(image.getdata())) < 100).astype('uint32')
return vector