BrushCue Example: Add Frame¶
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
composition_color_profile_2 = brushcue.composition_color_profile(image_input_1)
float_constant_3 = brushcue.float_constant(0.0)
rgba_color_constant_4 = brushcue.r_g_b_a_color_constant(1, 1, 1, 1)
composition_size_5 = brushcue.composition_size(image_input_1)
transform_2d_identity_6 = brushcue.transform2_identity()
float_constant_7 = brushcue.float_constant(1.0)
float_constant_8 = brushcue.float_constant(1.0)
int_constant_9 = brushcue.int_constant(2)
int_constant_10 = brushcue.int_constant(2)
int_constant_11 = brushcue.int_constant(200)
frame_color_12 = brushcue.r_g_b_a_color_passthrough(rgba_color_constant_4)
vector_2_float_from_components_13 = brushcue.vector2f_from_components(float_constant_7, float_constant_8)
frame_width_14 = brushcue.int_passthrough(int_constant_11)
int_to_float_15 = brushcue.int_to_float(frame_width_14)
int_to_float_16 = brushcue.int_to_float(frame_width_14)
int_multiply_17 = brushcue.int_multiply(frame_width_14, int_constant_9)
int_multiply_18 = brushcue.int_multiply(frame_width_14, int_constant_10)
vector_2_float_from_components_19 = brushcue.vector2f_from_components(int_to_float_15, int_to_float_16)
vector_2_int_from_components_20 = brushcue.vector2i_from_components(int_multiply_17, int_multiply_18)
transform_2d_translation_21 = brushcue.transform2_translation(transform_2d_identity_6, vector_2_float_from_components_19)
vector_2_int_add_22 = brushcue.vector2i_add(composition_size_5, vector_2_int_from_components_20)
transform_2d_scale_23 = brushcue.transform2_scale(transform_2d_translation_21, vector_2_float_from_components_13)
background_color_rect_24 = brushcue.composition_color_rect(frame_color_12, composition_color_profile_2, vector_2_int_add_22)
transform_2d_rotate_25 = brushcue.transform2_rotate(transform_2d_scale_23, float_constant_3)
blend_image_over_background_26 = brushcue.composition_blend_alpha(image_input_1, background_color_rect_24, transform_2d_rotate_25)
ctx = brushcue.Context()
result = blend_image_over_background_26.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]: