BrushCue Example: Duotone Effect¶
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
lightness_threshold_2 = brushcue.composition_lightness_threshold(input_image_1, 0.5)
string_constant_3 = brushcue.string_constant("let mask = input.r;\nlet color = mix(shadow_color, highlight_color, mask);\nreturn vec4<f32>(color.r, color.g, color.b, 1);\n")
string_constant_4 = brushcue.string_constant("\n")
color_profile_srgb_5 = brushcue.color_profile_s_r_g_b()
color_profile_srgb_6 = brushcue.color_profile_s_r_g_b()
string_constant_7 = brushcue.string_constant("highlight_color")
rgba_color_constant_8 = brushcue.r_g_b_a_color_constant(0.87, 0.87, 0.49, 1)
dictionary_create_9 = brushcue.dictionary_create()
string_constant_10 = brushcue.string_constant("shadow_color")
rgba_color_constant_11 = brushcue.r_g_b_a_color_constant(0.09, 0.23, 0.06, 1)
rgba_color_add_to_dictionary_12 = brushcue.r_g_b_a_color_add_to_dictionary(dictionary_create_9, string_constant_10, rgba_color_constant_11)
rgba_color_add_to_dictionary_13 = brushcue.r_g_b_a_color_add_to_dictionary(rgba_color_add_to_dictionary_12, string_constant_7, rgba_color_constant_8)
composition_color_transformer_shader_14 = brushcue.composition_color_transformer_shader(lightness_threshold_2, string_constant_3, string_constant_4, color_profile_srgb_5, color_profile_srgb_6, rgba_color_add_to_dictionary_13)
ctx = brushcue.Context()
result = composition_color_transformer_shader_14.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]: