Transform¶
- class imgproxykit.Transform(*options: Option, **kwargs: Unpack[ScalarOptions]) None[source]¶
Define reusable image processing options.
Stores an immutable tuple of options for reuse with
imgproxykit.Client.url(). Pass option instances or scalar keyword arguments; scalar options follow the positional options in keyword order.Options retain their supplied order during serialization. Imgproxy determines the image processing pipeline and resolves omitted arguments using its defaults. Preset options reference names configured on the imgproxy server and are not expanded here.
- options¶
Tuple of processing options. Defaults to an empty tuple, which adds no processing option segments to the URL.
Collect positional options, followed by scalar keyword options.
- Parameters:¶
- *options: Option¶
Processing option instances in serialization order. Repeated options are retained without merging.
- **kwargs: Unpack[ScalarOptions]¶
Scalar processing arguments, such as
quality=85orformat='webp'. Converted to option instances and appended in keyword order.
Examples
Combine a resize option with scalar quality and format options:
>>> from imgproxykit import Transform >>> from imgproxykit.options import Resize >>> thumbnail = Transform( ... Resize(width=96, height=96, mode='fill'), ... quality=85, ... format='webp', ... ) >>> [option.name for option in thumbnail.options] ['resize', 'quality', 'format']