BrushCue Example: Scale by Factor¶
You can use this tool online at https://www.brushcue.com/tools/scale-by-factor
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
float_constant_2 = brushcue.float_constant(1.0)
composition_size_3 = brushcue.composition_size(input_image_1)
composition_size_4 = brushcue.composition_size(input_image_1)
factor_5 = brushcue.float_passthrough(float_constant_2)
vector_2_int_get_x_6 = brushcue.vector2i_x(composition_size_3)
vector_2_int_get_y_7 = brushcue.vector2i_y(composition_size_4)
int_to_float_8 = brushcue.int_to_float(vector_2_int_get_x_6)
int_to_float_9 = brushcue.int_to_float(vector_2_int_get_y_7)
float_multiply_10 = brushcue.float_multiply(int_to_float_8, factor_5)
float_multiply_11 = brushcue.float_multiply(int_to_float_9, factor_5)
float_round_to_int_12 = brushcue.float_round_to_int(float_multiply_10)
float_round_to_int_13 = brushcue.float_round_to_int(float_multiply_11)
vector_2_int_from_components_14 = brushcue.vector2i_from_components(float_round_to_int_12, float_round_to_int_13)
composition_scale_bilinear_interpolation_15 = brushcue.composition_bilinear_interpolation(input_image_1, vector_2_int_from_components_14)
ctx = brushcue.Context()
result = composition_scale_bilinear_interpolation_15.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]: