本文整理汇总了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