imagecat.operator.transform module¶
Operators that modify images by transforming content.
- imagecat.operator.transform.composite(graph, name, inputs)[source]¶
Composite foreground and background layers using a mask and optional transformation.
- Parameters
graph (Graph, required) – Graph that owns this task.
name (hashable object, required) – Name of the task executing this function.
inputs (Named Inputs, required) – Inputs for this operator.
- Named Inputs
background (
imagecat.data.Image
, required) – Image containing the background layer.bglayer (
str
, optional) – Name of the background layer. Defaults toNone
.fglayer (
str
, optional) – Name of the foreground layer. Defaults toNone
.foreground (
imagecat.data.Image
, required) – Image containing the foreground layer.layer (
str
, optional) – Name of the output image layer. Defaults to the value of bglayer.mask (
imagecat.data.Image
, optional) – Image containing the foreground layer mask. If omitted, the foreground layer is assumed to be 100% opaque.masklayer (
str
, optional) – Name of the mask layer. Defaults toNone
.orientation (number, optional) – Rotation of the foreground layer for the composition. Default: 0.
pivot ((x, y) tuple, optional) – Position of the foreground pivot point. All rotation and positioning is relative to this point. Default: [“0.5w”, “0.5h”], which is centered on the foreground.
position ((x, y) tuple, optional) – Position of the foreground layer over the background layer. All rotation and positioning is relative to the pivot point. Default: [“0.5w”, “0.5h”], which is centered on the background.
- Returns
image – New image with a single solid-color layer.
- Return type
- imagecat.operator.transform.offset(graph, name, inputs)[source]¶
Offset layers in an image.
- Parameters
graph (
graphcat.Graph
, required) – Graph that owns this task.name (hashable object, required) – Name of the task executing this function.
inputs (Named Inputs, required) – Inputs for this operator.
- Named Inputs
image (
imagecat.data.Image
, required) – Image containing layers to be offset.layers (
str
, optional) – Pattern matching the layers to be offset. Default: ‘*’, which offsets all layers.offset ((x, y) tuple, required) – Distance to offset layers along each dimension.
- Returns
image – A copy of the input image with some layers offset.
- Return type
- imagecat.operator.transform.resize(graph, name, inputs)[source]¶
Resize an image to a new resolution.
- Parameters
graph (
graphcat.Graph
, required) – Graph that owns this task.name (hashable object, required) – Name of the task executing this function.
inputs (Named Inputs, required) – Inputs for this operator.
- Named Inputs
image (
imagecat.data.Image
, required) – Image to be resized.order (
int
, optional) – Resampling filter order. Default: ‘3’ for bicubic resampling.res ((width, height) tuple, optional) – New resolution of the image along each dimension.
- Returns
image – A copy of the input image that has been resized.
- Return type