Python PIL.Image.NONE Examples
The following are 8
code examples of PIL.Image.NONE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PIL.Image
, or try the search function
.
Example #1
Source File: resize.py From open_model_zoo with Apache License 2.0 | 6 votes |
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)
Example #2
Source File: resize.py From open_model_zoo with Apache License 2.0 | 6 votes |
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
Example #3
Source File: __init__.py From Legofy with MIT License | 5 votes |
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)
Example #4
Source File: renderPM.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def _convert2pilp(im): Image = _getImage() return im.convert("P", dither=Image.NONE, palette=Image.ADAPTIVE)
Example #5
Source File: renderPM.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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)
Example #6
Source File: renderPM.py From stdm with GNU General Public License v2.0 | 5 votes |
def _convert2pilp(im): Image = _getImage() return im.convert("P", dither=Image.NONE, palette=Image.ADAPTIVE)
Example #7
Source File: renderPM.py From stdm with GNU General Public License v2.0 | 5 votes |
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)
Example #8
Source File: image_encoders.py From nupic.vision with GNU Affero General Public License v3.0 | 5 votes |
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