BrushCue Example: Add Frame¶

Open In Colab

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

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

image_input_1 = brushcue.composition_monet_women_with_parasol() # insert your own image here
rgba_color_constant_2 = brushcue.r_g_b_a_color_constant(1, 1, 1, 1)
composition_color_profile_3 = brushcue.composition_color_profile(image_input_1)
composition_size_4 = brushcue.composition_size(image_input_1)
vector_2_float_from_components_5 = brushcue.vector2f_from_components(1.0, 1.0)
transform_2d_identity_6 = brushcue.transform2_identity()
frame_width_7 = brushcue.int_passthrough(200)
int_to_float_8 = brushcue.int_to_float(frame_width_7)
int_to_float_9 = brushcue.int_to_float(frame_width_7)
int_multiply_10 = brushcue.int_multiply(frame_width_7, 2)
int_multiply_11 = brushcue.int_multiply(frame_width_7, 2)
vector_2_float_from_components_12 = brushcue.vector2f_from_components(int_to_float_8, int_to_float_9)
vector_2_int_from_components_13 = brushcue.vector2i_from_components(int_multiply_10, int_multiply_11)
transform_2d_translation_14 = brushcue.transform2_translation(transform_2d_identity_6, vector_2_float_from_components_12)
vector_2_int_add_15 = brushcue.vector2i_add(composition_size_4, vector_2_int_from_components_13)
transform_2d_scale_16 = brushcue.transform2_scale(transform_2d_translation_14, vector_2_float_from_components_5)
background_color_rect_17 = brushcue.composition_color_rect(rgba_color_constant_2, composition_color_profile_3, vector_2_int_add_15)
transform_2d_rotate_18 = brushcue.transform2_rotate(transform_2d_scale_16, 0.0)
blend_image_over_background_19 = brushcue.composition_blend_alpha(image_input_1, background_color_rect_17, transform_2d_rotate_18)

ctx = brushcue.Context()
result = blend_image_over_background_19.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