BrushCue Example: Liquify¶

Open In Colab

You can use this tool online at https://www.brushcue.com/tools/liquify

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
amplitude_2 = brushcue.float_passthrough(15.45)
float_multiply_3 = brushcue.float_multiply(amplitude_2, 2.0)
float_multiply_4 = brushcue.float_multiply(amplitude_2, 2.0)
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)
composition_bounds_8 = brushcue.composition_bounds(input_image_1)
composition_liquify_9 = brushcue.composition_liquify(input_image_1, amplitude_2, 0.017)
bounds2f_min_x_10 = brushcue.bounds2f_min_x(composition_bounds_5)
bounds2f_min_y_11 = brushcue.bounds2f_min_y(composition_bounds_6)
bounds2f_width_12 = brushcue.bounds2f_width(composition_bounds_7)
bounds2f_height_13 = brushcue.bounds2f_height(composition_bounds_8)
float_add_14 = brushcue.float_add(bounds2f_min_x_10, amplitude_2)
float_add_15 = brushcue.float_add(bounds2f_min_y_11, amplitude_2)
float_subtract_16 = brushcue.float_subtract(bounds2f_width_12, float_multiply_3)
float_subtract_17 = brushcue.float_subtract(bounds2f_height_13, float_multiply_4)
bounds_2d_float_from_x_y_width_height_18 = brushcue.bounds2f_from_x_y_width_height(float_add_14, float_add_15, float_subtract_16, float_subtract_17)
composition_crop_19 = brushcue.composition_crop(composition_liquify_9, bounds_2d_float_from_x_y_width_height_18)

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