When translating a colour image to black and white (mode "L"), The current version supports all possible conversions between Omitted, a mode is chosen so that all information in the imageĪnd the palette can be represented without a palette. Method translates pixels through the palette. The Image Class Image() (class) convert(mode, matrix=None) Register_open(id, factory, accept=None) id factory accept Preinit() register_extension(id, extension) id extension Must implement read, seek, and tell methods, This is a lazy operation this function identifies the file, but theĪctual image data is not read from the file until you try to processĪ filename (string) or a file object. Opens and identifies the given image file. New(mode, size, color=0) mode size color Returns: init() isDirectory(f) isImageType(t) isStringType(t) isTupleType(t) merge(mode, bands) mode bands Returns: Getmodetype(mode) mode Returns: Raises KeyError:įor more information about this class, see The Image Class. Getmodebase(mode) mode Returns: Raises KeyError: Getmodebands(mode) mode Returns: Raises KeyError: Getmodetype to get the mode used to store each individual Returns a tuple containing the names of individual bands (use If you have an entire image in a string, wrap it in a Information on available decoders, see the section Writing Your Own File Decoder. You can also use any pixel decoder supported by PIL. In its simplest form, this function takes three arguments Mode size data decoder_name *args Returns:įromstring(mode, size, data, decoder_name="raw", *args) Ĭreates an image memory from pixel data in a string. StringIO object, and use open to load it. If you have an entire image file in a string, wrap it in a Note that this function decodes pixel data only, not entire images. For other modes, this function behaves like a corresponding Not all modesĬan share memory support modes include "L", "RGBX", "RGBA", and Original buffer object are reflected in this image). This function is similar to fromstring, but uses data in (New in 1.1.4) Creates an image memory from pixel data in a string Out = image1 * (1.0 - alpha) + image2 * alphaĬomposite(image1, image2, mask) image1 image2 maskĮval(image, function) image function Returns:įrombuffer(mode, size, data, decoder_name="raw", *args) The PIL.Image Module The PIL.Image Module blend(im1, im2, alpha) Ĭreates a new image by interpolating between two input images, using
0 Comments
Leave a Reply. |