Skip to content

Split Image Into Channels

SUMMARY

Split Image Into Channels splits a multi-channel image into its individual channels.

Given an (H, W, C) image, it returns one single-channel (H, W) image per input channel, in the same order as the input (e.g. R, G, B for an RGB image; B, G, R for BGR; R, G, B, A for RGBA). A grayscale (H, W) input is first converted to BGR, so the result is 3 identical channels rather than an error. It is the inverse of merge_image_from_channels — use the two together to process a single channel in isolation and recombine.

Use this Skill when you want to isolate and process a single color channel.

The Skill

python
from telekinesis import pupil

image_channels = pupil.split_image_into_channels(image=image)
channel_images = image_channels.to_list()
API Reference
Full parameter and return type documentation for split_image_into_channels.
View Reference →

Example

Input Image

Input image

Original multi-channel image

Channel 1 (Red)

Channel 1

First channel

Channel 2 (Green)

Channel 2

Second channel

Channel 3 (Blue)

Channel 3

Third channel

The Code

python
"""Demonstrates splitting an image into color channels."""

from loguru import logger
import rerun as rr

from telekinesis import pupil, datatypes


def split_image_into_channels_example():
    """Splits an image into its color channels."""
    # ===================== Load Image ==========================================
    image_url = "https://assets.telekinesis.ai/examples/v1/images/vegetables.jpg"
    image = datatypes.Image.from_url(image_url)

    # ===================== Run Skill ==========================================
    image_channels = pupil.split_image_into_channels(image=image)

    # ===================== Log ================================================
    logger.success(f"Split {image} into channels")
    logger.success(f"Result: {image_channels}")

    # ===================== Visualization  (Optional) ======================
    rr.init("split_image_into_channels_example", spawn=True)
    datatypes.visualize(image, entity_path="1-Original")
    channel_names = ["Red", "Green", "Blue"]
    for i, channel_image in enumerate(image_channels):
        datatypes.visualize(channel_image, entity_path=f"{i + 2}-{channel_names[i]}")

if __name__ == "__main__":
    split_image_into_channels_example()

Runnable examples are available in the Telekinesis examples repository.

Follow the README in that repository to set up the environment, run this specific example with:

bash
cd telekinesis-examples
python examples/image_processing/split_image_into_channels.py

Parameter Configuration

KeyTypeDefaultDescription
imagedatatypes.Image | np.ndarrayrequiredThe input image to split, shape (H, W, C). A grayscale (H, W) image is converted to BGR first, producing 3 identical channels

Returns

TypeDescription
datatypes.ImageBatchOne single-channel datatypes.Image per input channel, in input-channel order. Call .to_list() for a plain list[datatypes.Image], or index/iterate the batch directly

Raises

ExceptionCondition
TypeErrorimage has an invalid type
ConfigurationErrorThe TELEKINESIS_API_KEY environment variable is not set
SerializationErrorThe request input failed to serialize, or the response failed to deserialize
RequestTimeoutErrorThe request to the Pupil service timed out
TransportErrorA network failure occurred before a response was received
ClientErrorThe Pupil service rejected the request due to invalid input, invalid data, or another unexpected 4xx response
AuthenticationErrorThe API key was rejected as invalid or expired
AuthenticationServiceErrorThe authentication service was unavailable
ServerErrorThe Pupil service returned a 5xx or otherwise unexpected error response

How to Tune the Parameters

The split_image_into_channels Skill takes a single input and has no tunable behavior — the number and order of output channels is fully determined by the input image.

image

  • Controls: Which image is split, and therefore how many channels come out (3 for RGB/BGR, 4 for RGBA, 3 identical channels for a grayscale input) and in what order.
  • Default: required, no default
  • No numeric tuning is available; the output order always mirrors the input's channel order.

TIP

Best practice: Know your input's channel order before indexing the result — index 0 is R for an RGB image but B for a BGR image. Convert with convert_image_color_space first if you need a specific, known order.

Where to Use the Skill

Common pipelines include:

  • Per-channel processing – Apply a filter or enhancement to a single channel (e.g. blur only the blue channel) before recombining with merge_image_from_channels
  • Channel-based analysis – Inspect or threshold one channel's intensity distribution independently
  • Channel swapping – Reorder channels (e.g. RGB to BGR) by splitting and merging in a different order

Alternative Skills

Skillvs. Split Image Into Channels
merge_image_from_channelsThe inverse operation — recombines single-channel images into one multi-channel image. Use it after processing the channels this Skill produces.
convert_image_color_spaceConverts the whole image to a different color space in one call. Use this Skill instead only when you need per-channel access rather than a full conversion.

When Not to Use the Skill

Do not use Split Image Into Channels when:

  • You only need a single channel, not all of them (index the array directly, or convert to grayscale with convert_image_color_space)
  • The image is already single-channel (grayscale) (splitting just duplicates it three times — a no-op you can skip)
  • You need channels of a different color space (e.g. HSV, LAB) (convert with convert_image_color_space first, then split)