imagecat.operator module¶
Functions that produce, consume, and modify Imagecat images.
- imagecat.operator.delete(graph, name, inputs)[source]¶
Delete layers from an image.
- 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
image (
imagecat.data.Image
, required) – Image with layers to be deleted.layers (
str
, optional) – Pattern matching the image layers are deleted. Default: “*”, which deletes all layers.
- Returns
image – A copy of the input image with some layers deleted.
- Return type
- imagecat.operator.load(graph, name, inputs)[source]¶
Load an image from a file.
The file loader plugins in
imagecat.io
are used to load specific file formats. See that module for details, and to write loaders of your own.- 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
path (
str
, required) – Filesystem path of the file to be loaded.- Returns
image – Image loaded from the file.
- Return type
- imagecat.operator.merge(graph, name, inputs)[source]¶
Merge multiple images into one.
This operator merges the layers from multiple images into a single image. The images must all have the same resolution. Upstream inputs are merged in order, sorted by input name. Later image layers with duplicate names will overwrite earlier layers. Callers can prevent this by renaming layers upstream with the
rename()
operator.See also
imagecat.operator.transform.composite()
Composites one image over another using a mask.
- 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
every input (
imagecat.data.Image
, optional) – Images to be merged.- Returns
image – New image containing the union of all input layers.
- Return type
- imagecat.operator.remap(graph, name, inputs)[source]¶
Merge and split layers from an image.
- Parameters
graph (Graph, required) – Graphcat 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 image layers and channels to be mapped.mapping (
dict
, optional) – Maps existing layers and channels to the output. Default: {}, which returns an empty image.
- Returns
image – A new image containing only the mapped layers and channels.
- Return type
- imagecat.operator.rename(graph, name, inputs)[source]¶
Rename layers within an image.
- 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
image (
imagecat.data.Image
, required) – Image containing layers to be renamed.changes (
dict
, optional) – Maps existing names to new names. Default: {}, which does nothing.
- Returns
image – A copy of the input image with some layers renamed.
- Return type
- imagecat.operator.save(graph, name, inputs)[source]¶
Save an image to a file.
The file saver plugins in
imagecat.io
are used to save specific file formats. See that module for details, and to write savers of your own.- 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 function, including:
- Named Inputs
image (
imagecat.data.Image
, required) – Image to be saved.path (
str
, required) – Filesystem path of the file to be saved.layers (
str
, optional) – Pattern matching the layers to be saved. Default: ‘*’, which saves all layers.