BrushCue Example: Duotone Effect¶

Open In Colab

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

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

input_image_1 = brushcue.composition_monet_women_with_parasol() # insert your own image here
function_body_2 = brushcue.string_constant("  let l = input.r;\n  return mix(color1, color2, l);\n")
string_constant_3 = brushcue.string_constant("// put your helpers here\n\n\n\n\n")
color_profile_oklaba_4 = brushcue.color_profile_ok_lab_a()
color_profile_srgb_5 = brushcue.color_profile_s_r_g_b()
bool_constant_6 = brushcue.bool_constant(False)
curve_pivoted_sigmoid_7 = brushcue.curve_pivoted_sigmoid(0.5, 3.0)
string_constant_8 = brushcue.string_constant("color2")
rgba_color_constant_9 = brushcue.r_g_b_a_color_constant(0.05, 0.73, 0, 1)
dictionary_create_10 = brushcue.dictionary_create()
string_constant_11 = brushcue.string_constant("color1")
rgba_color_constant_12 = brushcue.r_g_b_a_color_constant(0, 0, 0, 1)
composition_lightness_curve_13 = brushcue.composition_l_curve(input_image_1, curve_pivoted_sigmoid_7)
add_color_1_to_dictionary_14 = brushcue.r_g_b_a_color_add_to_dictionary(dictionary_create_10, string_constant_11, rgba_color_constant_12)
add_color_2_to_dictionary_15 = brushcue.r_g_b_a_color_add_to_dictionary(add_color_1_to_dictionary_14, string_constant_8, rgba_color_constant_9)
composition_custom_transformer_shader_16 = brushcue.composition_custom_transformer_shader(composition_lightness_curve_13, function_body_2, string_constant_3, color_profile_oklaba_4, color_profile_srgb_5, add_color_2_to_dictionary_15, bool_constant_6)

ctx = brushcue.Context()
result = composition_custom_transformer_shader_16.execute(ctx)
composition = result.as_composition()
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
Out[1]:
No description has been provided for this image