BrushCue Example: Glitch Filter Animation¶

Open In Colab

You can use this tool online at https://www.brushcue.com/tools/glitch-filter-animation

In [ ]:
!pip install brushcue
In [1]:
import brushcue
import io

input_image_1 = brushcue.composition_monet_women_with_parasol() # insert your own image here
cyan_ghost_offset_base_2 = brushcue.transform2_identity()
red_ghost_offset_base_3 = brushcue.transform2_identity()
rgba_color_constant_4 = brushcue.r_g_b_a_color_constant(0, 0, 0, 1)
composition_color_profile_5 = brushcue.composition_color_profile(input_image_1)
jitter_base_identity_6 = brushcue.transform2_identity()
composition_bounds_7 = brushcue.composition_bounds(input_image_1)
float_multiply_8 = brushcue.float_multiply(0.0, 2.2)
float_multiply_9 = brushcue.float_multiply(0.0, 40.0)
float_multiply_10 = brushcue.float_multiply(0.0, 2.2)
float_multiply_11 = brushcue.float_multiply(0.0, 2.2)
float_multiply_12 = brushcue.float_multiply(0.0, 36.0)
float_multiply_13 = brushcue.float_multiply(0.0, 91.0)
float_multiply_14 = brushcue.float_multiply(0.0, 86.0)
float_multiply_15 = brushcue.float_multiply(0.0, 14.0)
float_multiply_16 = brushcue.float_multiply(0.0, 66.0)
float_multiply_17 = brushcue.float_multiply(0.0, 2.2)
float_multiply_18 = brushcue.float_multiply(0.0, 2.2)
float_multiply_19 = brushcue.float_multiply(0.0, 2.2)
float_multiply_20 = brushcue.float_multiply(0.0, 2.2)
float_multiply_21 = brushcue.float_multiply(0.0, 2.2)
float_multiply_22 = brushcue.float_multiply(0.0, 24.0)
float_multiply_23 = brushcue.float_multiply(0.0, 18.0)
bounds2f_width_24 = brushcue.bounds2f_width(composition_bounds_7)
bounds2f_height_25 = brushcue.bounds2f_height(composition_bounds_7)
float_sine_26 = brushcue.float_sin(float_multiply_8)
float_cosine_27 = brushcue.float_cos(float_multiply_9)
float_sine_28 = brushcue.float_sin(float_multiply_10)
float_sine_29 = brushcue.float_sin(float_multiply_11)
float_sine_30 = brushcue.float_sin(float_multiply_12)
float_sine_31 = brushcue.float_sin(float_multiply_13)
float_sine_32 = brushcue.float_sin(float_multiply_14)
float_sine_33 = brushcue.float_sin(float_multiply_15)
float_cosine_34 = brushcue.float_cos(float_multiply_16)
float_sine_35 = brushcue.float_sin(float_multiply_17)
float_sine_36 = brushcue.float_sin(float_multiply_18)
float_sine_37 = brushcue.float_sin(float_multiply_19)
float_sine_38 = brushcue.float_sin(float_multiply_20)
float_sine_39 = brushcue.float_sin(float_multiply_21)
float_sine_40 = brushcue.float_sin(float_multiply_22)
float_cosine_41 = brushcue.float_cos(float_multiply_23)
float_round_to_int_42 = brushcue.float_round_to_int(bounds2f_width_24)
float_round_to_int_43 = brushcue.float_round_to_int(bounds2f_height_25)
float_subtract_44 = brushcue.float_subtract(float_sine_26, 0.6)
float_subtract_45 = brushcue.float_subtract(float_sine_28, 0.6)
float_subtract_46 = brushcue.float_subtract(float_sine_29, 0.6)
float_multiply_47 = brushcue.float_multiply(float_sine_30, 0.012)
float_multiply_48 = brushcue.float_multiply(float_sine_31, 0.004)
float_multiply_49 = brushcue.float_multiply(float_sine_32, 10.0)
float_multiply_50 = brushcue.float_multiply(float_sine_33, 3.0)
float_multiply_51 = brushcue.float_multiply(float_cosine_34, 2.0)
float_subtract_52 = brushcue.float_subtract(float_sine_35, 0.6)
float_subtract_53 = brushcue.float_subtract(float_sine_36, 0.6)
float_subtract_54 = brushcue.float_subtract(float_sine_37, 0.6)
float_subtract_55 = brushcue.float_subtract(float_sine_38, 0.6)
float_subtract_56 = brushcue.float_subtract(float_sine_39, 0.6)
float_multiply_57 = brushcue.float_multiply(float_sine_40, 3.0)
float_multiply_58 = brushcue.float_multiply(float_cosine_41, 3.0)
vector_2_int_from_components_59 = brushcue.vector2i_from_components(float_round_to_int_42, float_round_to_int_43)
float_max_60 = brushcue.float_max(0.0, float_subtract_44)
float_max_61 = brushcue.float_max(0.0, float_subtract_45)
float_max_62 = brushcue.float_max(0.0, float_subtract_46)
float_add_63 = brushcue.float_add(float_multiply_47, float_multiply_48)
float_max_64 = brushcue.float_max(0.0, float_subtract_52)
float_max_65 = brushcue.float_max(0.0, float_subtract_53)
float_max_66 = brushcue.float_max(0.0, float_subtract_54)
float_max_67 = brushcue.float_max(0.0, float_subtract_55)
float_max_68 = brushcue.float_max(0.0, float_subtract_56)
float_round_to_int_69 = brushcue.float_round_to_int(float_multiply_57)
float_round_to_int_70 = brushcue.float_round_to_int(float_multiply_58)
background_color_and_size_71 = brushcue.composition_color_rect(rgba_color_constant_4, composition_color_profile_5, vector_2_int_from_components_59)
float_multiply_72 = brushcue.float_multiply(float_max_60, 2.5)
float_multiply_73 = brushcue.float_multiply(float_max_61, 2.5)
float_multiply_74 = brushcue.float_multiply(float_max_62, 2.5)
float_multiply_75 = brushcue.float_multiply(float_max_64, 2.5)
float_multiply_76 = brushcue.float_multiply(float_max_65, 2.5)
float_multiply_77 = brushcue.float_multiply(float_max_66, 2.5)
float_multiply_78 = brushcue.float_multiply(float_max_67, 2.5)
float_multiply_79 = brushcue.float_multiply(float_max_68, 2.5)
int_greater_than_80 = brushcue.int_greater_than(float_round_to_int_69, 1)
int_less_than_81 = brushcue.int_less_than(float_round_to_int_70, -2)
float_multiply_82 = brushcue.float_multiply(float_multiply_72, 0.72)
float_multiply_83 = brushcue.float_multiply(float_multiply_73, 0.72)
float_multiply_84 = brushcue.float_multiply(float_multiply_74, -20.0)
float_multiply_85 = brushcue.float_multiply(float_multiply_75, 20.0)
float_multiply_86 = brushcue.float_multiply(float_multiply_76, float_add_63)
float_multiply_87 = brushcue.float_multiply(float_multiply_79, float_cosine_27)
float_if_88 = brushcue.float_if(int_greater_than_80, float_multiply_49, float_multiply_50)
float_if_89 = brushcue.float_if(int_less_than_81, float_multiply_51, 0.0)
vector_2_float_from_components_90 = brushcue.vector2f_from_components(float_multiply_84, 0.0)
vector_2_float_from_components_91 = brushcue.vector2f_from_components(float_multiply_85, 0.0)
float_multiply_92 = brushcue.float_multiply(float_multiply_87, 0.01)
float_multiply_93 = brushcue.float_multiply(float_multiply_77, float_if_88)
float_multiply_94 = brushcue.float_multiply(float_multiply_78, float_if_89)
cyan_ghost_offset_95 = brushcue.transform2_translation(cyan_ghost_offset_base_2, vector_2_float_from_components_90)
red_ghost_offset_96 = brushcue.transform2_translation(red_ghost_offset_base_3, vector_2_float_from_components_91)
vector_2_float_from_components_97 = brushcue.vector2f_from_components(float_multiply_86, float_multiply_92)
vector_2_float_from_components_98 = brushcue.vector2f_from_components(float_multiply_93, float_multiply_94)
rgb_split_offset_99 = brushcue.composition_chroma_offset(input_image_1, vector_2_float_from_components_97)
animated_horizontal_glitch_jitter_100 = brushcue.transform2_translation(jitter_base_identity_6, vector_2_float_from_components_98)
blend_example_image_over_background_101 = brushcue.composition_blend_alpha(rgb_split_offset_99, background_color_and_size_71, animated_horizontal_glitch_jitter_100)
red_ghost_tint_102 = brushcue.composition_linear_transform(blend_example_image_over_background_101, 0.85, 0.08, 0.08, 0.0, 0.12, 0.04, 0.04, 0.0, 0.1, 0.04, 0.04, 0.0, 0.0, 0.0, 0.0, float_multiply_83)
composition_bounds_103 = brushcue.composition_bounds(blend_example_image_over_background_101)
composition_bounds_104 = brushcue.composition_bounds(blend_example_image_over_background_101)
cyan_ghost_tint_105 = brushcue.composition_linear_transform(blend_example_image_over_background_101, 0.04, 0.02, 0.02, 0.0, 0.12, 0.75, 0.12, 0.0, 0.1, 0.12, 0.85, 0.0, 0.0, 0.0, 0.0, float_multiply_82)
alpha_blend_red_ghost_copy_106 = brushcue.composition_blend_alpha(red_ghost_tint_102, blend_example_image_over_background_101, red_ghost_offset_96)
bounds2f_width_107 = brushcue.bounds2f_width(composition_bounds_103)
bounds2f_height_108 = brushcue.bounds2f_height(composition_bounds_103)
bounds2f_width_109 = brushcue.bounds2f_width(composition_bounds_104)
bounds2f_height_110 = brushcue.bounds2f_height(composition_bounds_104)
alpha_blend_cyan_ghost_copy_111 = brushcue.composition_blend_alpha(cyan_ghost_tint_105, alpha_blend_red_ghost_copy_106, cyan_ghost_offset_95)
float_round_to_int_112 = brushcue.float_round_to_int(bounds2f_width_107)
float_round_to_int_113 = brushcue.float_round_to_int(bounds2f_height_108)
float_round_to_int_114 = brushcue.float_round_to_int(bounds2f_width_109)
float_round_to_int_115 = brushcue.float_round_to_int(bounds2f_height_110)
vector_2_int_from_components_116 = brushcue.vector2i_from_components(float_round_to_int_112, float_round_to_int_113)
vector_2_int_from_components_117 = brushcue.vector2i_from_components(float_round_to_int_114, float_round_to_int_115)
vector_2_int_get_x_118 = brushcue.vector2i_x(vector_2_int_from_components_116)
vector_2_int_get_y_119 = brushcue.vector2i_y(vector_2_int_from_components_117)
int_subtract_120 = brushcue.int_subtract(vector_2_int_get_x_118, 56)
int_subtract_121 = brushcue.int_subtract(vector_2_int_get_y_119, 24)
bounds_2d_int_from_x_y_width_height_122 = brushcue.bounds2i_from_x_y_width_height(28, 12, int_subtract_120, int_subtract_121)
safe_edge_crop_123 = brushcue.composition_crop(alpha_blend_cyan_ghost_copy_111, bounds_2d_int_from_x_y_width_height_122)
result_animation_124 = brushcue.sequence_graph(3.0, 0.0, safe_edge_crop_123)

ctx = brushcue.Context()
result = result_animation_124.execute(ctx)
result = result.as_sequence()
# You can render the result to an video file