Let's start by scaling the image using percentages. Let's say we want to scale the image to be 60% of the original size:
using Images, ImageView source_image = load("sample-images/cats-3061372_640.jpg"); scale_percentage = 0.6 new_size = trunc.(Int, size(source_image) .* scale_percentage) resized_image = imresize(source_image, new_size) imshow(resized_image);
We have done the following:
- We have loaded the image using the load function from the Images package
- We have defined the scaling percentage in the scale_percentage variable
- We have calculated the new_size by first multiplying the current size by our proportion and then converting the float values to int
- We have resized the image using the new_size values
The ...