Skip to main content

Crate pillow_rs

Crate pillow_rs 

Source
Expand description

Pure Rust image processing with a Pillow-compatible core API.

pillow-rs is the runtime-independent image crate used by the Python and WebAssembly bindings in this workspace. It takes Rust primitives, image buffers, mode strings, and font bytes as input; binding crates are responsible for translating Python objects, JavaScript objects, file paths, and host I/O before calling into this crate.

§Design Boundary

Core modules do not depend on Python or JavaScript runtime types. Public functions model Pillow behavior where practical, but their contracts are expressed in Rust terms: Image values, crate::raster::DynamicImage buffers, FreeTypeFont values, and PilError failures.

§Allocation Safety

Image allocation paths validate dimensions before allocating. This prevents zero-sized images, integer overflow, and accidental attacker-controlled large allocations before a pixel buffer is created.

§Modes And Layout

Public image APIs use Pillow mode strings such as "L", "RGB", "RGBA", "CMYK", "P", and "1". Core operations normalize those modes into Rust image buffers before dispatching to CPU, SIMD, or GPU backends. Raw byte APIs return tightly packed pixels in the image’s current mode unless a method says otherwise.

§Feature Flags

  • gpu enables the wgpu/WebGPU backend where an operation has a shader.
  • parallel opt-in enables Rayon-backed Parallel CPU row and pixel paths; SIMD adapters and GPU execution stay thread-scheduler independent.
  • image-codecs-all enables all codec features exposed through image-slash-star; individual codec features can be selected instead.

CPU execution remains the fallback path. Feature flags should not change the public Pillow-style contract of an operation.

§Public API Boundary

pillow-rs/src/lib.rs is the single public API definition for this crate. Implementation modules are private crate internals; downstream callers, including the Python and WebAssembly bindings, must use the exact root symbols re-exported below such as Image, FreeTypeFont, Draw, imageops_grayscale, and imagefont_getbbox.

§Quick Start

use pillow_rs::Image;

let image = Image::new(4, 4, "RGB", (0, 128, 255, 255)).unwrap();
assert_eq!(image.size().unwrap(), (4, 4));
assert_eq!(image.mode().unwrap(), "RGB");

§Converting Modes

use pillow_rs::Image;

let rgb = Image::new(2, 2, "RGB", (255, 0, 0, 255)).unwrap();
let gray = rgb.convert("L", None, None, None, None).unwrap();
assert_eq!(gray.mode().unwrap(), "L");
assert_eq!(gray.tobytes().unwrap().len(), 4);

Structs§

ArrayLayout
Resolved Pillow image and raw-decoder layout for an array descriptor.
BatchError
Identity-bearing failure; admission failures consume their allocated ID.
BatchResult
A result’s identity does not depend on completion position or buffer offset.
Draw
Drawing context for Pillow-style image mutation.
EnumeratePixels
Enumerate the pixels of an image.
EnumeratePixelsMut
Enumerate the pixels of an image.
EnumerateRows
Enumerate the rows of an image.
EnumerateRowsMut
Enumerate the rows of an image.
ExifCompatFields
Prepared fields for Pillow’s lightweight public EXIF compatibility object.
FreeTypeFont
Pillow FreeTypeFont-compatible handle backed by the pure-Rust FreeType path.
GpuBatchConfig
Independent bounds; device limits do not measure available GPU memory.
GpuBatchExecutor
Caller-driven, bounded scheduler for existing lazy Image graphs.
GpuBatchStats
Bounded cumulative counters, suitable for verifying actual batch execution.
GpuImage
Immutable GPU-owned pixels. Clones share the same charged allocation.
ImageBuffer
Generic image buffer parameterised by its Pixel type and Container.
ImageFontFaceInfo
Native face attributes shared by Pillow’s font facade and fontdone.
ImageFontLoadOptions
Optional Pillow ImageFont.truetype() constructor arguments.
ImageFontTextOptions
Optional Pillow FreeTypeFont text-layout/render arguments.
ImageFontVariantOptions
Optional Pillow FreeTypeFont.font_variant() override arguments.
ImageFontVariationAxis
One Pillow FreeTypeFont.get_variation_axes() axis record.
ImageSequenceIterator
Rust-owned state for Pillow’s public multi-frame image iterator.
Luma
Grayscale colors.
LumaA
Grayscale colors + alpha channel
PilFont
Parsed PILfont metrics and glyph bitmap.
PilFontMask
A rendered PILfont mask with one byte per pixel.
PipelineOperationTelemetry
Evidence for one public operation inside a backend execution.
PipelineResourceTelemetry
Resource counters attached to one completed backend execution sample.
Pixels
Iterate over pixel refs.
PixelsMut
Iterate over mutable pixel refs.
PreparedColor3DLut
A table whose dimensions and channel count have passed the public Color3DLUT constructor checks.
PythonNewColorInput
Host-neutral values extracted for a public Image.new color argument.
Rect
A rectangular region within an in-memory raster.
Rgb
RGB colors.
Rgba
RGB colors + alpha channel
Rows
Iterate over rows of an image
RowsMut
Iterate over mutable rows of an image
StatResult
PIL-compatible statistics result. Every statistic is a per-band list.

Enums§

AlphaCompositeBox
Host-neutral coordinate input for public Image.alpha_composite calls.
Backend
Compute backend used to execute a materialized image pipeline.
BatchErrorKind
Failure category for the explicit executor.
BatchKey
A compact application key. Duplicate keys are allowed; job IDs stay unique.
BatchOutput
Materialized result storage selected by the stream.
CenteringInput
Host-neutral centering input for ImageOps.fit and ImageOps.pad.
ChannelSelector
Host-neutral selector for Image.getchannel.
Color3DLutTable
Host-neutral table input accepted by ImageFilter.Color3DLUT.
ColorMode
Pillow image mode used by pipeline operations.
ColorValue
Resolves an RGB color for a Pillow ImageColor.getcolor destination mode.
DitherMethod
Dither algorithm used by conversion or quantization operations.
DrawBoxInput
Host-neutral coordinate input for ImageDraw rectangle-like primitives.
DrawCircleCenterInput
Host-neutral center input for ImageDraw.circle.
DrawColorInput
Host-neutral color input for ImageDraw operations.
DrawPointsInput
Host-neutral coordinate input for ImageDraw point-based primitives.
DynamicImage
A Dynamic Image
EvalInputKind
Host-neutral input classification for the callable form of Image.eval.
ExtendedColorType
A Pillow processing color layout, including packed and sub-byte variants.
FormattedExtrema
Pillow’s public extrema shape: a single-band image returns one pair, while multiband images return one pair per band.
FormattedImageData
Pillow’s flat versus multiband getdata result after core formatting.
FormattedPixelValue
A Pillow pixel value after the core has applied the logical mode’s band shape. Bindings only need to map these variants to their native scalar/tuple value types.
Image
Core image value used by Pillow-style operations.
ImageAnalysisMask
Host-neutral optional mask input for image analysis operations.
ImageFontBBoxValue
A Pillow-compatible scalar from a font bounding box.
ImageFontSourceInput
Host-neutral source supplied to ImageFont.truetype.
ImageFontTextInput
Host-neutral text input for Pillow’s font methods.
ImageFontVariationAxesInput
Host-neutral input for Pillow’s variation-axis list requirement.
ImageFontVariationNameInput
Host-neutral input for Pillow’s named-variation setter.
ImageInfoValue
Host-neutral values exposed through Pillow’s compatibility Image.info mapping.
ImageOpsColor
Host-neutral color input for ImageOps.pad and ImageOps.expand.
ImageOpsMask
Host-neutral mask input for ImageOps functions.
ImagingCoreBytesInput
Host-neutral input for converting Pillow’s scalar ImagingCore view to bytes.
MergeInput
Host-neutral input classification for Image.merge bands.
PaletteColorInput
Host-neutral input for ImagePalette.getcolor.
PaletteTransparency
Pillow-compatible pending transparency stored in Image.info.
PasteSource
Source pixels for Image::paste.
PilError
Error type returned by fallible pillow-rs core APIs.
PilFontGlyphImage
Glyph-image state used by Pillow PILfont loading.
PilFontMode
Native storage mode of a PILfont glyph image and its rendered masks.
PilFontTextInput
Host-neutral text input for the legacy PILfont API.
PipelineOp
Every image-producing operation maps to one variant. Input image is the source; output image is the result of applying this op.
PixelMode
Logical Pillow sample layout for mutating pixel operations.
PutAlphaInput
Host-neutral input for Pillow’s Image.putalpha wrapper.
PutDataInput
Callback-free bulk values extracted by a host-language binding.
PutDataValue
One public Image.putdata pixel after host-language type extraction.
PutDataValueKind
Shape of one host-language value accepted by Image.putdata.
PutPixelValue
Host-neutral value extracted for a public Image.putpixel call.
PythonConvertModeInput
Host-neutral destination mode input for the Python conversion wrapper.
PythonConvertPaletteInput
Host-neutral palette input for the Python conversion wrapper.
PythonDitherInput
Host-neutral Python-facing dither input.
PythonOpenFormatsInput
Host-neutral format allow-list input for the Python Image.open wrapper.
PythonOpenModeInput
Host-neutral mode input for the Python Image.open wrapper.
PythonPasteBox
Host-neutral box input for the Python Image.paste wrapper.
PythonPasteMask
Host-neutral mask input for the Python Image.paste wrapper.
PythonPasteSource
Host-neutral source input for the Python Image.paste wrapper.
QuantizePalette
Host-neutral palette argument for the public quantize entry point.
ReduceBox
Host-neutral optional crop input for the public Image.reduce method.
ReduceFactor
Host-neutral factor input for the public Image.reduce method.
RegularPolygonCircle
Host-neutral ImageDraw.regular_polygon bounding-circle input.
RegularPolygonSides
Host-neutral side-count input for ImageDraw.regular_polygon.
ResampleFilter
Resampling filter used by resize-like operations.
ResampleInput
Public resampling input accepted by Pillow resize-like methods.
RotateExpandInput
Host-neutral boolean input for Pillow’s rotate wrapper.
RotatePointInput
Host-neutral center or translation input for Pillow’s rotate wrapper.
RotateResampleInput
Host-neutral resampling input for Pillow’s rotate wrapper.
SolarizeInput
Host-neutral threshold input for solarize_with_input.
StatValue
Scalar or per-band statistic value.
TransformData
Host-neutral transform data after the binding has performed only Python sequence extraction.
TransformFill
Host-neutral fill-color input for public Image.transform calls.
TransformMethod
Coordinate transform algorithm.
TransposeInput
Host-neutral input for Pillow’s integer-or-name transpose argument.
TransposeMethod
Pillow transpose operation.

Traits§

ConvertBuffer
Provides color conversions for whole image buffers.
EncodableLayout
Types which are safe to treat as an immutable byte slice in a pixel layout for image encoding.
Enlargeable
An Enlargeable::Larger value should be enough to calculate the sum (average) of a few hundred or thousand Enlargeable values.
FromColor
Converts one Pillow pixel representation into another.
FromPrimitive
Converts a numeric component into a pixel subcomponent without changing layout.
GenericImage
A trait for manipulating images.
GenericImageView
Read-only access to a two-dimensional Pillow raster.
Pixel
Pixel behavior required by Pillow’s generic in-memory image buffers.
Primitive
The type of each channel in a pixel. For example, this can be u8, u16, f32.

Functions§

active_backends
Returns active backends ordered by routing preference.
align_row_to_32
Convert each scanline from 8-bit to 32-bit aligned (PIL / Qt compatibility).
available_backends
Returns every backend compiled into this crate.
backend_enabled
Returns whether a backend is currently eligible for automatic routing.
chops_add
Adds two images with scale and offset.
chops_add_modulo
Adds two images modulo 256.
chops_constant
Fills active channels with a constant byte value.
chops_darker
Keeps the darker pixel at each position.
chops_difference
Computes absolute channel difference between two images.
chops_duplicate
Duplicate an image through the compute pipeline.
chops_hard_light
Applies hard-light blend mode.
chops_invert
Inverts an image through the ImageChops compatibility surface.
chops_lighter
Keeps the lighter pixel at each position.
chops_logical_and
Applies logical AND, writing 255 when both stored samples are nonzero.
chops_logical_or
Applies logical OR, writing 255 when either stored sample is nonzero.
chops_logical_xor
Applies logical XOR, writing 255 when exactly one stored sample is nonzero.
chops_multiply
Multiplies two images channel-by-channel.
chops_offset
Offsets image contents by wrapping pixels around both axes.
chops_offset_with_default
Offsets image contents, using xoffset for the omitted y offset.
chops_overlay
Applies overlay blend mode.
chops_screen
Applies screen blend mode.
chops_soft_light
Applies soft-light blend mode.
chops_subtract
Subtracts image2 from image1 with scale and offset.
chops_subtract_modulo
Subtracts two images modulo 256.
color3dlut_check_size
Validates and normalizes the user-facing Color3DLUT size argument.
color3dlut_generate_table
Generates a Color3DLUT table while keeping traversal and callback result policy in the runtime-independent core.
color3dlut_prepare_table
Validates and flattens a Color3DLUT table.
color3dlut_repr
Formats the Pillow-compatible representation of a Color3DLUT filter.
color3dlut_transform_table
Transforms a Color3DLUT table while keeping traversal and callback result validation in the runtime-independent core.
color_has_explicit_alpha
Whether Pillow’s ImageColor.getrgb returns a four-tuple for this color string. Pillow emits alpha only for 4/8-digit hex (#rgba, #rrggbbaa) and for rgba(...) syntax; every other accepted form returns a three-tuple even when the parsed value happens to be opaque.
disable_backend
Disables a backend for future automatic routing.
enable_backend
Enables a backend for future automatic routing.
exif_get_orientation
Extract Orientation tag (0x0112) from raw EXIF bytes. Returns None if not found.
exif_remove_orientation
Remove IFD0’s Orientation entry after the pixels have been transposed.
from_resolved_array_interface
Build an image from a resolved array-interface layout and its packed bytes.
getcolor
Resolve parsed RGBA components to the requested Pillow color mode.
image_alpha_composite
Composites im2 over im1 and returns a new image.
image_blend
Blends two same-sized images by linear interpolation.
image_composite
Composites image1 over image2 using mask.
image_effect_mandelbrot
Generates a Mandelbrot effect image.
image_effect_mandelbrot_with_extent
Validates a host-provided Mandelbrot extent and delegates to the typed Rust implementation. The host type name is metadata used only to preserve Pillow’s diagnostic for non-four-item sequences.
image_effect_noise
Generates Gaussian noise using the source image dimensions.
image_effect_noise_from_size
Generates a Gaussian-noise L image for Pillow’s module-level effect.
image_effect_spread
Spreads pixels outward by up to distance pixels.
image_eval
Applies a lookup table to each pixel.
image_eval_callable
Builds and applies a callable lookup table using the image’s band count.
image_eval_float
Applies a floating-point LUT to Pillow’s byte-valued single-band modes.
image_eval_point_transform
Applies Pillow’s affine callable transform for scalar images.
image_eval_replicated_for_image
Applies a single-band lookup table to every band in image.
image_eval_validated
Validates and applies a pre-expanded Pillow lookup table.
image_frombytes
Creates an image from raw bytes using Pillow’s supported raw decoder.
image_frombytes_owned
Creates an image from an owned raw byte buffer, avoiding a second copy for raw raster modes when the decoder can adopt the supplied allocation.
image_linear_gradient
Generates a 256 by 256 linear gradient.
image_merge
Merges single-band images into a multi-band image.
image_merge_inputs
Merges host-extracted band inputs while keeping invalid-item handling in the core contract.
image_radial_gradient
Generates a 256 by 256 radial gradient.
imagefont_font_format
Return the active font-driver format reported by fontdone.
imagefont_from_bytes
Load a TrueType/OpenType face from bytes at the requested Pillow point size.
imagefont_from_bytes_with_options
Load a TrueType/OpenType face from bytes with Pillow constructor options.
imagefont_from_source
Load a TrueType/OpenType face from a host-marshaled source.
imagefont_get_transposed_mask
Render a font mask and apply Pillow’s optional transpose operation.
imagefont_get_transposed_mask_input
Return a transposed mask for host-classified text input.
imagefont_get_variation_axes
Return Pillow’s public variation-axis records.
imagefont_get_variation_names
Return Pillow’s public named-variation style names.
imagefont_getbbox
Return Pillow’s public text bounding box.
imagefont_getbbox_bytes
Return Pillow’s public text bounding box for byte text.
imagefont_getbbox_bytes_with_options
Return Pillow’s public text bounding box for byte text with optional layout arguments.
imagefont_getbbox_input_with_options
Return Pillow’s public text bounding box for host-classified text input.
imagefont_getbbox_with_optional_font
Return a text bounding box using Pillow’s optional draw-font rules.
imagefont_getbbox_with_options
Return Pillow’s public text bounding box with optional layout arguments.
imagefont_getlength
Return Pillow’s public text length in pixels.
imagefont_getlength_bytes
Return Pillow’s public text length for byte text.
imagefont_getlength_bytes_with_options
Return Pillow’s public text length for byte text with optional layout arguments.
imagefont_getlength_input_with_options
Return text length for host-classified text input with optional layout.
imagefont_getlength_with_optional_font
Return text length using Pillow’s optional draw-font rules.
imagefont_getlength_with_optional_font_input
Return text length using optional-font rules and host-classified text input.
imagefont_getlength_with_options
Return Pillow’s public text length with optional layout arguments.
imagefont_getmask
Return the Pillow-compatible grayscale text mask.
imagefont_getmask2
Render a Pillow-compatible mask with offset.
imagefont_getmask2_bytes
Render a Pillow-compatible mask with offset for byte text.
imagefont_getmask2_bytes_with_options
Render a Pillow-compatible byte-text mask with optional render arguments.
imagefont_getmask2_bytes_with_start
Render a Pillow-compatible byte-text mask with a fractional raster start.
imagefont_getmask2_input_with_options
Render a Pillow-compatible mask with offset for host-classified text.
imagefont_getmask2_with_options
Render a Pillow-compatible mask with optional render arguments.
imagefont_getmask2_with_start
Render a Pillow-compatible mask with a fractional raster start.
imagefont_getmask_bytes
Return the Pillow-compatible grayscale text mask for byte text.
imagefont_getmask_bytes_with_options
Return the Pillow-compatible grayscale text mask for byte text with optional render arguments.
imagefont_getmask_input_with_options
Return the Pillow-compatible grayscale text mask for host-classified text.
imagefont_getmask_with_options
Return the Pillow-compatible grayscale text mask with optional render arguments.
imagefont_getmetrics
Return Pillow’s public ascent/descent metrics.
imagefont_getname
Return Pillow’s public (family, style) font name tuple.
imagefont_getname_optional
Return Pillow’s raw public name tuple, preserving missing face names.
imagefont_has_variations
Return whether the font exposes variation axes.
imagefont_is_scalable
Return whether the active font face has scalable outlines.
imagefont_load_default
Loads the same embedded default font subset as Pillow.
imagefont_mask_image
Wrap font-rendered mask bytes in the Pillow image representation.
imagefont_multiline_textbbox
Return Pillow’s public multiline text bounding box.
imagefont_multiline_textbbox_with_optional_font
Return a multiline text bounding box using Pillow’s optional draw-font rules.
imagefont_multiline_textbbox_with_optional_font_input
Return a multiline text bounding box using host-classified text input.
imagefont_native_face_attrs
Return Pillow native _imagingft.Font public face attributes.
imagefont_native_face_info
Return the active font face capabilities reported by fontdone.
imagefont_native_getlength_26dot6
Return Pillow native _imagingft.Font.getlength() 26.6 advance.
imagefont_native_getsize
Return Pillow native _imagingft.Font.getsize() size and offset tuple.
imagefont_native_getvaraxes
Return Pillow native _imagingft.Font.getvaraxes() records.
imagefont_native_getvarnames
Return Pillow native _imagingft.Font.getvarnames() records.
imagefont_native_render
Return Pillow native _imagingft.Font.render() mask and offset.
imagefont_native_render_input
Return Pillow native render output for host-classified text input.
imagefont_native_setvaraxes
Set Pillow native _imagingft.Font variation coordinates.
imagefont_native_setvarname
Set Pillow native _imagingft.Font named instance index.
imagefont_set_variation_by_axes
Set variation design coordinates from Pillow-style user coordinates.
imagefont_set_variation_by_axes_input
Validate and set variation axes using Pillow’s list-only public contract.
imagefont_set_variation_by_name
Set a named variation instance by Pillow-style name bytes.
imagefont_set_variation_by_name_input
Set a named variation instance after applying Pillow’s host input rules.
imagefont_size
Return the requested Pillow point size for this FreeType font.
imagefont_text_bbox
Return the non-negative text mask extent for Pillow-style text layout.
imagefont_text_bbox_bytes
Return the non-negative text mask extent for Pillow byte text.
imagefont_textbbox_at_with_optional_font
Return an offset text bounding box using Pillow’s optional draw-font rules.
imagefont_textbbox_at_with_optional_font_input
Return an offset text bounding box using host-classified text input.
imagefont_variant
Create a Pillow-compatible variant font.
imagefont_variant_with_options
Create a Pillow-compatible variant font with public override arguments.
imageops_autocontrast
Normalizes image contrast by clipping darkest and lightest values.
imageops_autocontrast_with_mask
Normalizes contrast after validating an optional Pillow mask.
imageops_colorize
Colorizes an L image by mapping black and white endpoints.
imageops_contain
Resizes an image to fit within (w, h) while preserving aspect ratio.
imageops_contain_with_input
ImageOps.contain with a host-neutral public filter value.
imageops_cover
Resizes an image to cover (w, h) while preserving its aspect ratio.
imageops_cover_with_input
ImageOps.cover with a host-neutral public filter value.
imageops_crop
Crops the same border width from every image edge.
imageops_equalize
Equalizes the image histogram.
imageops_equalize_with_mask
Equalizes an image after validating an optional Pillow mask.
imageops_exif_transpose
Applies the EXIF orientation transform used by ImageOps.exif_transpose.
imageops_expand
Adds a border around an image.
imageops_expand_with_input
Expands an image after resolving the fill against its native Pillow mode.
imageops_fit
Resizes and crops an image to exactly fit (w, h).
imageops_fit_with_input
ImageOps.fit with filter and centering validation owned by core.
imageops_flip
Flips an image vertically.
imageops_grayscale
Converts an image to grayscale using Pillow-compatible BT.601 luma.
imageops_invert
Inverts through the ImageOps.invert compatibility path.
imageops_mirror
Mirrors an image horizontally.
imageops_pad
Resizes and pads an image to exactly (w, h).
imageops_pad_with_input
ImageOps.pad with filter and centering validation owned by core.
imageops_posterize
Reduces the number of stored high bits per color channel.
imageops_scale_with_input
ImageOps.scale with the integer/enum resampling value exposed by Pillow.
imageops_solarize
Inverts pixel values at or above threshold.
imageops_solarize_with_input
Solarizes with numeric or host-defined threshold comparisons.
imageops_validate_colorize_mode
Validates that an image can be colorized.
imageops_validate_deform_resample
Validates the resampling argument accepted by ImageOps.deform.
imaging_core_to_bytes
Converts scalar ImagingCore samples to bytes with Pillow’s errors.
make_lut
Builds a Pillow point/eval lookup table from a host callback.
normalize_draw_box
Normalizes a flat or nested ImageDraw bounding box.
normalize_draw_circle_center
Normalizes the center accepted by Pillow’s circle wrapper.
normalize_draw_width
Normalize Pillow’s optional draw width at the core boundary.
normalize_font_bbox
Normalizes font bounding-box coordinates to Pillow’s scalar types.
normalize_layout_engine
Normalize Pillow’s public layout-engine selector for the no-raqm build.
normalize_python_convert_dither
Normalizes a Python-facing dither value into the symbolic core form.
normalize_python_rotate
Validates the Python-facing rotate arguments and returns the effective expansion flag.
normalize_rounded_rectangle_box
Normalizes the rounded-rectangle box, preserving its two-scalar Pillow diagnostic before falling back to the shared box validation.
normalize_transpose_input
Normalize the integer-or-name orientation accepted by TransposedFont.
normalize_transposed_font_input
Normalize the orientation stored by ImageFont.TransposedFont.
outline_curve_points
Compute cubic Bezier curve subdivision points. Returns a flat list of (x, y) integer pairs for the curve from t=1..steps. control_points must have at least 8 elements: [x0, y0, x1, y1, x2, y2, x3, y3]. Matches Pillow’s src/libImaging/Draw.c::ImagingOutlineCurve algorithm.
palette_getcolor
Searches a flat RGB palette for an exact color match.
palette_getcolor_append
Finds or appends a color in a Pillow-compatible palette.
palette_getcolor_validate
Validates and stores a palette color from a host-neutral component slice.
palette_getcolor_validate_input
Validates and stores a palette color from a host-neutral input.
palette_to_text
Formats a palette as Pillow-compatible text.
parse_color_str
Parses a CSS/Pillow-style color string into an RGBA tuple.
parse_color_str_unclamped
Parse Pillow’s ImageColor.getrgb legacy forms without clamping.
parse_resample
Parses a Pillow resampling filter name.
parse_resample_input
Parses a public Pillow resampling value.
prepare_color3dlut
Validates a flat table once at the Rust public boundary.
prepare_exif_compat
Prepares EXIF compatibility metadata without touching Python objects.
prepare_kernel
Normalizes the arguments accepted by ImageFilter.Kernel.
resolve_array_layout
Resolve Pillow’s array-interface type key, mode, raw mode, size, and dimensional limit.
resolve_new_color
Resolves Image.new color input into core RGBA storage.
stat_from_histogram
Computes Pillow ImageStat.Stat values from a precomputed histogram.
stat_from_list
Computes basic statistics for non-image numeric input.
transpose_name_from_int
Returns Pillow’s symbolic transpose name for an integer enum value.
transposed_bbox
Normalize a wrapped font bounding box using Pillow’s TransposedFont rules.
validate_eval_input
Validates the host-independent part of Image.eval input handling.
validate_kernel_coefficients
Validates the coefficient count shared by Kernel construction and application. Size-shape validation intentionally remains in prepare_kernel, because Pillow defers that particular error until the filter is applied.
validate_python_convert_dither
Validates a Python-facing dither argument that arrived as a string.
validate_python_open_inputs
Validates the Python Image.open mode and format arguments.
validate_python_open_source_bytes
Validates byte paths before the binding translates decode failures.
validate_transparency_mask
Validate a Pillow transparency/statistics mask without touching host types.
validate_transposed_length
Validate whether Pillow defines text length for a transposed font.

Type Aliases§

GrayAlphaImage
Sendable grayscale + alpha channel image buffer (8-bit).
GrayImage
Sendable grayscale image buffer (8-bit).
Rgb32FImage
Sendable 32-bit float RGB image buffer.
RgbImage
Sendable RGB image buffer (8-bit per channel).
Rgba32FImage
Sendable 32-bit float RGBA image buffer.
RgbaImage
Sendable RGBA image buffer (8-bit per channel).