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
gpuenables the wgpu/WebGPU backend where an operation has a shader.parallelopt-in enables Rayon-backed Parallel CPU row and pixel paths; SIMD adapters and GPU execution stay thread-scheduler independent.image-codecs-allenables all codec features exposed throughimage-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§
- Array
Layout - Resolved Pillow image and raw-decoder layout for an array descriptor.
- Batch
Error - Identity-bearing failure; admission failures consume their allocated ID.
- Batch
Result - A result’s identity does not depend on completion position or buffer offset.
- Draw
- Drawing context for Pillow-style image mutation.
- Enumerate
Pixels - Enumerate the pixels of an image.
- Enumerate
Pixels Mut - Enumerate the pixels of an image.
- Enumerate
Rows - Enumerate the rows of an image.
- Enumerate
Rows Mut - Enumerate the rows of an image.
- Exif
Compat Fields - Prepared fields for Pillow’s lightweight public EXIF compatibility object.
- Free
Type Font - Pillow
FreeTypeFont-compatible handle backed by the pure-Rust FreeType path. - GpuBatch
Config - Independent bounds; device limits do not measure available GPU memory.
- GpuBatch
Executor - Caller-driven, bounded scheduler for existing lazy Image graphs.
- GpuBatch
Stats - Bounded cumulative counters, suitable for verifying actual batch execution.
- GpuImage
- Immutable GPU-owned pixels. Clones share the same charged allocation.
- Image
Buffer - Generic image buffer parameterised by its Pixel type and Container.
- Image
Font Face Info - Native face attributes shared by Pillow’s font facade and fontdone.
- Image
Font Load Options - Optional Pillow
ImageFont.truetype()constructor arguments. - Image
Font Text Options - Optional Pillow
FreeTypeFonttext-layout/render arguments. - Image
Font Variant Options - Optional Pillow
FreeTypeFont.font_variant()override arguments. - Image
Font Variation Axis - One Pillow
FreeTypeFont.get_variation_axes()axis record. - Image
Sequence Iterator - 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.
- PilFont
Mask - A rendered PILfont mask with one byte per pixel.
- Pipeline
Operation Telemetry - Evidence for one public operation inside a backend execution.
- Pipeline
Resource Telemetry - Resource counters attached to one completed backend execution sample.
- Pixels
- Iterate over pixel refs.
- Pixels
Mut - Iterate over mutable pixel refs.
- Prepared
Color3D Lut - A table whose dimensions and channel count have passed the public
Color3DLUTconstructor checks. - Python
NewColor Input - Host-neutral values extracted for a public
Image.newcolor 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
- Stat
Result - PIL-compatible statistics result. Every statistic is a per-band list.
Enums§
- Alpha
Composite Box - Host-neutral coordinate input for public
Image.alpha_compositecalls. - Backend
- Compute backend used to execute a materialized image pipeline.
- Batch
Error Kind - Failure category for the explicit executor.
- Batch
Key - A compact application key. Duplicate keys are allowed; job IDs stay unique.
- Batch
Output - Materialized result storage selected by the stream.
- Centering
Input - Host-neutral centering input for
ImageOps.fitandImageOps.pad. - Channel
Selector - Host-neutral selector for
Image.getchannel. - Color3D
LutTable - Host-neutral table input accepted by
ImageFilter.Color3DLUT. - Color
Mode - Pillow image mode used by pipeline operations.
- Color
Value - Resolves an RGB color for a Pillow
ImageColor.getcolordestination mode. - Dither
Method - Dither algorithm used by conversion or quantization operations.
- Draw
BoxInput - Host-neutral coordinate input for ImageDraw rectangle-like primitives.
- Draw
Circle Center Input - Host-neutral center input for
ImageDraw.circle. - Draw
Color Input - Host-neutral color input for ImageDraw operations.
- Draw
Points Input - Host-neutral coordinate input for ImageDraw point-based primitives.
- Dynamic
Image - A Dynamic Image
- Eval
Input Kind - Host-neutral input classification for the callable form of
Image.eval. - Extended
Color Type - A Pillow processing color layout, including packed and sub-byte variants.
- Formatted
Extrema - Pillow’s public extrema shape: a single-band image returns one pair, while multiband images return one pair per band.
- Formatted
Image Data - Pillow’s flat versus multiband
getdataresult after core formatting. - Formatted
Pixel Value - 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.
- Image
Analysis Mask - Host-neutral optional mask input for image analysis operations.
- Image
FontB BoxValue - A Pillow-compatible scalar from a font bounding box.
- Image
Font Source Input - Host-neutral source supplied to
ImageFont.truetype. - Image
Font Text Input - Host-neutral text input for Pillow’s font methods.
- Image
Font Variation Axes Input - Host-neutral input for Pillow’s variation-axis list requirement.
- Image
Font Variation Name Input - Host-neutral input for Pillow’s named-variation setter.
- Image
Info Value - Host-neutral values exposed through Pillow’s compatibility
Image.infomapping. - Image
OpsColor - Host-neutral color input for
ImageOps.padandImageOps.expand. - Image
OpsMask - Host-neutral mask input for ImageOps functions.
- Imaging
Core Bytes Input - Host-neutral input for converting Pillow’s scalar
ImagingCoreview to bytes. - Merge
Input - Host-neutral input classification for
Image.mergebands. - Palette
Color Input - Host-neutral input for
ImagePalette.getcolor. - Palette
Transparency - Pillow-compatible pending transparency stored in
Image.info. - Paste
Source - Source pixels for
Image::paste. - PilError
- Error type returned by fallible
pillow-rscore APIs. - PilFont
Glyph Image - Glyph-image state used by Pillow PILfont loading.
- PilFont
Mode - Native storage mode of a PILfont glyph image and its rendered masks.
- PilFont
Text Input - Host-neutral text input for the legacy PILfont API.
- Pipeline
Op - Every image-producing operation maps to one variant. Input image is the source; output image is the result of applying this op.
- Pixel
Mode - Logical Pillow sample layout for mutating pixel operations.
- PutAlpha
Input - Host-neutral input for Pillow’s
Image.putalphawrapper. - PutData
Input - Callback-free bulk values extracted by a host-language binding.
- PutData
Value - One public
Image.putdatapixel after host-language type extraction. - PutData
Value Kind - Shape of one host-language value accepted by
Image.putdata. - PutPixel
Value - Host-neutral value extracted for a public
Image.putpixelcall. - Python
Convert Mode Input - Host-neutral destination mode input for the Python conversion wrapper.
- Python
Convert Palette Input - Host-neutral palette input for the Python conversion wrapper.
- Python
Dither Input - Host-neutral Python-facing dither input.
- Python
Open Formats Input - Host-neutral format allow-list input for the Python
Image.openwrapper. - Python
Open Mode Input - Host-neutral mode input for the Python
Image.openwrapper. - Python
Paste Box - Host-neutral box input for the Python
Image.pastewrapper. - Python
Paste Mask - Host-neutral mask input for the Python
Image.pastewrapper. - Python
Paste Source - Host-neutral source input for the Python
Image.pastewrapper. - Quantize
Palette - Host-neutral palette argument for the public quantize entry point.
- Reduce
Box - Host-neutral optional crop input for the public
Image.reducemethod. - Reduce
Factor - Host-neutral factor input for the public
Image.reducemethod. - Regular
Polygon Circle - Host-neutral
ImageDraw.regular_polygonbounding-circle input. - Regular
Polygon Sides - Host-neutral side-count input for
ImageDraw.regular_polygon. - Resample
Filter - Resampling filter used by resize-like operations.
- Resample
Input - Public resampling input accepted by Pillow resize-like methods.
- Rotate
Expand Input - Host-neutral boolean input for Pillow’s rotate wrapper.
- Rotate
Point Input - Host-neutral center or translation input for Pillow’s rotate wrapper.
- Rotate
Resample Input - Host-neutral resampling input for Pillow’s rotate wrapper.
- Solarize
Input - Host-neutral threshold input for
solarize_with_input. - Stat
Value - Scalar or per-band statistic value.
- Transform
Data - Host-neutral transform data after the binding has performed only Python sequence extraction.
- Transform
Fill - Host-neutral fill-color input for public
Image.transformcalls. - Transform
Method - Coordinate transform algorithm.
- Transpose
Input - Host-neutral input for Pillow’s integer-or-name transpose argument.
- Transpose
Method - Pillow transpose operation.
Traits§
- Convert
Buffer - Provides color conversions for whole image buffers.
- Encodable
Layout - Types which are safe to treat as an immutable byte slice in a pixel layout for image encoding.
- Enlargeable
- An
Enlargeable::Largervalue should be enough to calculate the sum (average) of a few hundred or thousand Enlargeable values. - From
Color - Converts one Pillow pixel representation into another.
- From
Primitive - Converts a numeric component into a pixel subcomponent without changing layout.
- Generic
Image - A trait for manipulating images.
- Generic
Image View - 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
xoffsetfor 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
image2fromimage1with 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.getrgbreturns a four-tuple for this color string. Pillow emits alpha only for 4/8-digit hex (#rgba,#rrggbbaa) and forrgba(...)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
im2overim1and returns a new image. - image_
blend - Blends two same-sized images by linear interpolation.
- image_
composite - Composites
image1overimage2usingmask. - 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
Limage for Pillow’s module-level effect. - image_
effect_ spread - Spreads pixels outward by up to
distancepixels. - 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.Fontpublic 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.Fontvariation coordinates. - imagefont_
native_ setvarname - Set Pillow native
_imagingft.Fontnamed 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
Limage 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.containwith 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.coverwith 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.fitwith 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.invertcompatibility path. - imageops_
mirror - Mirrors an image horizontally.
- imageops_
pad - Resizes and pads an image to exactly
(w, h). - imageops_
pad_ with_ input ImageOps.padwith filter and centering validation owned by core.- imageops_
posterize - Reduces the number of stored high bits per color channel.
- imageops_
scale_ with_ input ImageOps.scalewith 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
ImagingCoresamples 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_pointsmust have at least 8 elements: [x0, y0, x1, y1, x2, y2, x3, y3]. Matches Pillow’ssrc/libImaging/Draw.c::ImagingOutlineCurvealgorithm. - 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.getrgblegacy 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.newcolor input into core RGBA storage. - stat_
from_ histogram - Computes Pillow
ImageStat.Statvalues 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
TransposedFontrules. - validate_
eval_ input - Validates the host-independent part of
Image.evalinput handling. - validate_
kernel_ coefficients - Validates the coefficient count shared by
Kernelconstruction and application. Size-shape validation intentionally remains inprepare_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.openmode 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§
- Gray
Alpha Image - Sendable grayscale + alpha channel image buffer (8-bit).
- Gray
Image - Sendable grayscale image buffer (8-bit).
- Rgb32F
Image - Sendable 32-bit float RGB image buffer.
- RgbImage
- Sendable RGB image buffer (8-bit per channel).
- Rgba32F
Image - Sendable 32-bit float RGBA image buffer.
- Rgba
Image - Sendable RGBA image buffer (8-bit per channel).