BrushCue Example: Box Blur¶
You can use this tool online at https://www.brushcue.com/tools/box-blur
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
dimension_2 = brushcue.int_passthrough(8)
int_to_float_3 = brushcue.int_to_float(dimension_2)
int_to_float_4 = brushcue.int_to_float(dimension_2)
composition_bounds_5 = brushcue.composition_bounds(input_image_1)
composition_bounds_6 = brushcue.composition_bounds(input_image_1)
composition_bounds_7 = brushcue.composition_bounds(input_image_1)
int_to_float_8 = brushcue.int_to_float(dimension_2)
composition_bounds_9 = brushcue.composition_bounds(input_image_1)
int_to_float_10 = brushcue.int_to_float(dimension_2)
composition_box_blur_11 = brushcue.composition_box_blur(input_image_1, dimension_2)
bounds2f_min_x_12 = brushcue.bounds2f_min_x(composition_bounds_5)
bounds2f_min_y_13 = brushcue.bounds2f_min_y(composition_bounds_6)
bounds2f_width_14 = brushcue.bounds2f_width(composition_bounds_7)
float_multiply_15 = brushcue.float_multiply(int_to_float_8, 2.0)
bounds2f_height_16 = brushcue.bounds2f_height(composition_bounds_9)
float_multiply_17 = brushcue.float_multiply(int_to_float_10, 2.0)
float_add_18 = brushcue.float_add(bounds2f_min_x_12, int_to_float_3)
float_add_19 = brushcue.float_add(bounds2f_min_y_13, int_to_float_4)
float_subtract_20 = brushcue.float_subtract(bounds2f_width_14, float_multiply_15)
float_subtract_21 = brushcue.float_subtract(bounds2f_height_16, float_multiply_17)
bounds_2d_float_from_x_y_width_height_22 = brushcue.bounds2f_from_x_y_width_height(float_add_18, float_add_19, float_subtract_20, float_subtract_21)
crop_to_bounds_23 = brushcue.composition_crop(composition_box_blur_11, bounds_2d_float_from_x_y_width_height_22)
ctx = brushcue.Context()
result = crop_to_bounds_23.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]: