BrushCue Example: Shadow Tint¶

Open In Colab

You can use this tool online at https://www.brushcue.com/tools/shadow-tint

In [ ]:
!pip install brushcue
In [1]:
import io
from PIL import Image

import brushcue as bc

shadow_threshold = 0.35
oklab_a = 0.0
oklab_b = 0.0
chroma_offset = bc.Vector2f.from_components(oklab_a, oklab_b)
graph = bc.Composition.monet_women_with_parasol().color_transformer_shader(
    "  var blend = smoothstep(shadow_threshold + 0.1, shadow_threshold - 0.1, input.r);\n  return vec4<f32>(input.r, input.g + (chroma_offset.x * blend), input.b + (chroma_offset.y * blend), input.a);",
    "// You can write your helper functions here if you need them.",
    bc.ColorRepresentation.oklab_a(),
    bc.ColorRepresentation.oklab_a(),
    bc.Dictionary.create()
    .add("shadow_threshold", shadow_threshold)
    .add("chroma_offset", chroma_offset),
)

ctx = bc.Context()
composition = graph.execute(ctx)
data_bytes = composition.to_image_bytes(ctx)
img = Image.open(io.BytesIO(data_bytes))
img.thumbnail((400, 400))  # Remove this line for full resolution
img
[wgpu] using backend Metal — adapter 'Apple M5' (IntegratedGpu), driver ''
Out[1]:
No description has been provided for this image