ImageType.
Example:
udf alpha_composite()
im1(Image): The first image. Must have mode RGBA.im2(Image): The second image. Must have mode RGBA, and the same size as the first image.
Image: An~PIL.Image.Imageobject.
udf b64_encode()
img(Image): imageimage_format(String): image format supported by PIL
udf blend()
im1(Image): The first image.im2(Image): The second image. Must have the same mode and size as the first image.alpha(Float): The interpolation alpha factor. If alpha is 0.0, a copy of the first image is returned. If alpha is 1.0, a copy of the second image is returned. There are no restrictions on the alpha value. If necessary, the result is clipped to fit into the allowed output range.
Image: An~PIL.Image.Imageobject.
udf composite()
image1(Image): The first image.image2(Image): The second image. Must have the same mode and size as the first image.mask(Image): A mask image. This image can have mode “1”, “L”, or “RGBA”, and must have the same size as the other two images.
udf convert()
PIL.Image.Image.convert().
Parameters:
mode(String): The mode to convert to. See the Pillow documentation for a list of supported modes.
udf crop()
coordinate-system.
Note: Prior to Pillow 3.4.0, this was a lazy operation.
Parameters:
box(Json): The crop rectangle, as a (left, upper, right, lower)-tuple.
Image: An~PIL.Image.Imageobject.
udf effect_spread()
distance(Int): Distance to spread pixels.
udf entropy()
mask(Image | None): An optional mask.extrema(Json | None): An optional tuple of manually-specified extrema.
Float: A float value representing the image entropy
udf get_metadata()
udf getbands()
getbands on an RGB image returns (“R”, “G”, “B”).
Returns:
Json: A tuple containing band names.
udf getbbox()
alpha_only(Bool): Optional flag, defaulting toTrue. IfTrueand the image has an alpha channel, trim transparent pixels. Otherwise, trim pixels when all channels are zero. Keyword-only argument.
Json: The bounding box is returned as a 4-tuple defining the left, upper, right, and lower pixel coordinate. See :ref:coordinate-system. If the image is completely empty, this method returns None.
udf getchannel()
channel(Int): What channel to return. Could be index (0 for “R” channel of “RGB”) or channel name (“A” for alpha channel of “RGBA”).
Image: An image in “L” mode. .. versionadded:: 4.3.0
udf getcolors()
maxcolors(Int): Maximum number of colors. If this number is exceeded, this method returns None. The default limit is 256 colors.
Json: An unsorted list of (count, pixel) values.
udf getextrema()
Json: For a single-band image, a 2-tuple containing the minimum and maximum pixel value. For a multi-band image, a tuple containing one 2-tuple for each band.
udf getpalette()
rawmode(Any): The mode in which to return the palette.Nonewill return the palette in its current mode. .. versionadded:: 9.1.0
Json: A list of color values [r, g, b, …], or None if the image has no palette.
udf getpixel()
xy is a tuple containing the x and y coordinates.
Equivalent to PIL.Image.Image.getpixel()
Parameters:
xy(Json): The coordinates, given as (x, y).
udf getprojection()
Json: Two sequences, indicating where there are non-zero pixels along the X-axis and the Y-axis, respectively.
udf height()
udf histogram()
mask(Image | None): An optional mask.extrema(Json | None): An optional tuple of manually-specified extrema.
Json: A list containing pixel counts.
udf mode()
udf point()
PIL.Image.Image.point()
Parameters:
lut(Json): A lookup table.
udf quantize()
colors(Int): The desired number of colors, <= 256method(Int | None):Quantize.MEDIANCUT(median cut),Quantize.MAXCOVERAGE(maximum coverage),Quantize.FASTOCTREE(fast octree),Quantize.LIBIMAGEQUANT(libimagequant; check support usingPIL.features.check_featurewithfeature="libimagequant"). By default,Quantize.MEDIANCUTwill be used. The exception to this is RGBA images.Quantize.MEDIANCUTandQuantize.MAXCOVERAGEdo not support RGBA images, soQuantize.FASTOCTREEis used by default instead.kmeans(Int): Integer greater than or equal to zero.palette(Int | None): Quantize to the palette of givenPIL.Image.Image.dither(Int): Dithering method, used when converting from mode “RGB” to “P” or from “RGB” or “L” to “1”. Available methods areDither.NONEorDither.FLOYDSTEINBERG(default).
Image: A new image
udf reduce()
factor times.
If the size of the image is not dividable by factor, the resulting size will be rounded up.
Parameters:
factor(Int): A greater than 0 integer or tuple of two integers for width and height separately.box(Json | None): An optional 4-tuple of ints providing the source image region to be reduced. The values must be within(0, 0, width, height)rectangle. If omitted orNone, the entire source is used.
udf resize()
PIL.Image.Image.resize()
udf rotate()
PIL.Image.Image.rotate()
Parameters:
angle(Int): The angle to rotate the image, in degrees. Positive angles are counter-clockwise.
udf transpose()
method(Int): One of :pyTranspose.FLIP_LEFT_RIGHT, :pyTranspose.FLIP_TOP_BOTTOM, :pyTranspose.ROTATE_90, :pyTranspose.ROTATE_180, :pyTranspose.ROTATE_270, :pyTranspose.TRANSPOSEor :pyTranspose.TRANSVERSE.
Image: Returns a flipped or rotated copy of this image.