Back to Articles

2026-05-21

Image Editing in Python: Introducing BrushCue v1.0.0

By Anthony Dito

The Python image editing ecosystem is weak. Tasks that are trivial with desktop tools are at best cumbersome with Python. BrushCue v1.0.0 is ready, and the Python ecosystem gains Photoshop-esque image editing capabilities.

The API

Taking inspiration from PyTorch and Apple's CoreImage, BrushCue implements a lazy evaluation API. Under the hood, BrushCue is a DAG written in Rust. Here is a simple example for how to use the API.

Here is an that implements the Duotone Effect tool:

import brushcue
from PIL import Image
import io

# Insert your own image here
image = brushcue.composition_monet_women_with_parasol()

# Shader inputs
function_body = brushcue.string_constant("""
  let l = input.r;
  return mix(color1, color2, l);
""")
helpers = brushcue.string_constant("// put your helpers here\n\n\n\n\n")
input_profile = brushcue.color_profile_ok_lab_a()
output_profile = brushcue.color_profile_s_r_g_b()
use_alpha = brushcue.bool_constant(False)

# Lightness curve
curve = brushcue.curve_pivoted_sigmoid(0.5, 3.0)

# Duotone colors: black → green
color1_key = brushcue.string_constant("color1")
color2_key = brushcue.string_constant("color2")
color1 = brushcue.r_g_b_a_color_constant(0, 0, 0, 1)
color2 = brushcue.r_g_b_a_color_constant(0.05, 0.73, 0, 1)

uniforms = brushcue.dictionary_create()
uniforms = brushcue.r_g_b_a_color_add_to_dictionary(uniforms, color1_key, color1)
uniforms = brushcue.r_g_b_a_color_add_to_dictionary(uniforms, color2_key, color2)

# Apply lightness curve then duotone shader
curved = brushcue.composition_l_curve(image, curve)
duotone = brushcue.composition_custom_transformer_shader(
    curved, function_body, helpers, input_profile, output_profile, uniforms, use_alpha
)

ctx = brushcue.Context()
result = duotone.execute(ctx)
data_bytes = result.as_composition().to_image_bytes(ctx)
img = Image.open(io.BytesIO(data_bytes))
img.thumbnail((400, 400))  # remove for full resolution
img

You can view our documentation for a full list of operations and a list of examples like this.

Uses

The BrushCue API is sort of a programming language; therefore, the applications of the BrushCue API are enormous. To avoid enumerating all the possibilities, I will focus on the domains BrushCue benefits most.

The impetus for building the Python API for BrushCue was our struggles assembling datasets for computer vision models. We built a computer vision model for SwingPerfect that finds a moving baseball in a video. The minority of the time was building out the model architecture. The majority of the time was spent tinkering with the preprocessing of the input video: performing morphological operations, combining frames, blurring, etc. With BrushCue's image editing capabilities, preprocessing inputs for your computer vision models is easier. My preferred workflow is building out my computer vision preprocessing on the website, downloading the .brushcue file and then using that to generate my images in Python.

The BrushCue website and Python API were also built to bring artistic capabilities to LLMs. Diffusion models lack the determinism and tweakability that artists require. With BrushCue you work alongside an LLM making incremental edits to achieve the desired result rather than trying to hit the prompting jackpot.

Claude Code, Codex, etc. are good at writing Python. The BrushCue Python API is good at media editing. Combined, Claude Code becomes good at media editing. By using Python, you harness even more power by linking to other tools. The BrushCue website has an integrated LLM chat and we also expose an MCP, but using our Python API unlocks the power of the Python ecosystem with BrushCue's image editing capabilities.

What's Next

Sprinkled in the Python source code you will find traces of what comes next — videos, text and drawing. Stay tuned for those features in the BrushCue website and within the Python API.

Learn More

If you are like me, the best way to learn something is by using it. To that end, most tools on BrushCue have an associated Jupyter notebook demonstrating the BrushCue API. These Python examples have a link to open Google Colab where you can tinker. Here are some of the key links.