moduleĀ pixeltable.functions.image
Pixeltable UDFs for ImageType.
Example:
udfĀ alpha_composite()
Alpha composite im2 over im1.
Equivalent to PIL.Image.alpha_composite()
udfĀ b64_encode()
Convert image to a base64-encoded string.
Parameters:
udfĀ blend()
Return a new image by interpolating between two input images, using a constant alpha.
Equivalent to PIL.Image.blend()
udfĀ composite()
Return a composite image by blending two images using a mask.
Equivalent to PIL.Image.composite()
udfĀ convert()
Convert the image to a different mode.
Equivalent to
PIL.Image.Image.convert().
Parameters:
udfĀ crop()
Return a rectangular region from the image. The box is a 4-tuple defining the left, upper, right, and lower pixel
coordinates.
Equivalent to
PIL.Image.Image.crop()
udfĀ effect_spread()
Randomly spread pixels in an image.
Equivalent to
PIL.Image.Image.effect_spread()
Parameters:
distance (Int): The distance to spread pixels.
udfĀ entropy()
Returns the entropy of the image, optionally using a mask and extrema.
Equivalent to
PIL.Image.Image.entropy()
Parameters:
mask (Image | None): An optional mask image.
extrema (Json | None): An optional list of extrema.
Return metadata for the image.
udfĀ getbands()
Return a tuple containing the names of the image bands.
Equivalent to
PIL.Image.Image.getbands()
udfĀ getbbox()
Return a bounding box for the non-zero regions of the image.
Equivalent to PIL.Image.Image.getbbox()
Parameters:
alpha_only (Bool): If True, and the image has an alpha channel, trim transparent pixels. Otherwise,
trim pixels when all channels are zero.
udfĀ getchannel()
Return an L-mode image containing a single channel of the original image.
Equivalent to
PIL.Image.Image.getchannel()
Parameters:
channel (Int): The channel to extract. This is a 0-based index.
udfĀ getcolors()
Return a list of colors used in the image, up to a maximum of maxcolors.
Equivalent to
PIL.Image.Image.getcolors()
Parameters:
maxcolors (Int): The maximum number of colors to return.
udfĀ getextrema()
Return a 2-tuple containing the minimum and maximum pixel values of the image.
Equivalent to
PIL.Image.Image.getextrema()
udfĀ getpalette()
Return the palette of the image, optionally converting it to a different mode.
Equivalent to
PIL.Image.Image.getpalette()
Parameters:
mode (String | None): The mode to convert the palette to.
udfĀ getpixel()
Return the pixel value at the given position. The position 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()
Return two sequences representing the horizontal and vertical projection of the image.
Equivalent to
PIL.Image.Image.getprojection()
udfĀ height()
Return the height of the image.
udfĀ histogram()
Return a histogram for the image.
Equivalent to
PIL.Image.Image.histogram()
Parameters:
mask (Image | None): An optional mask image.
extrema (Json | None): An optional list of extrema.
udfĀ mode()
Return the image mode.
udfĀ point()
Map image pixels through a lookup table.
Equivalent to
PIL.Image.Image.point()
Parameters:
lut (Json): A lookup table.
udfĀ quantize()
Convert the image to āPā mode with the specified number of colors.
Equivalent to
PIL.Image.Image.quantize()
Parameters:
colors (Int): The number of colors to quantize to.
method (Int | None): The quantization method. See the
Pillow documentation
for a list of supported methods.
kmeans (Int): The number of k-means clusters to use.
palette (Image | None): The palette to use.
dither (Int): The dithering method. See the
Pillow documentation
for a list of supported methods.
udfĀ reduce()
Reduce the image by the given factor.
Equivalent to
PIL.Image.Image.reduce()
Parameters:
factor (Int): The reduction factor.
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 or None, the entire source is used.
udfĀ resize()
Return a resized copy of the image. The size parameter is a tuple containing the width and height of the new image.
Equivalent to
PIL.Image.Image.resize()
udfĀ rotate()
Return a copy of the image rotated by the given angle.
Equivalent to
PIL.Image.Image.rotate()
Parameters:
angle (Int): The angle to rotate the image, in degrees. Positive angles are counter-clockwise.
udfĀ transpose()
Transpose the image.
Equivalent to
PIL.Image.Image.transpose()
Parameters:
udfĀ width()
Return the width of the image.Last modified on January 15, 2026