This is a bonus section for scaling/resizing. The JuliaImages package has a very useful function called somepkg(restrict), which reduces the size of an image by two-fold along the dimensions specified. In other words, it scales the image by 50%.
restrict can be run in three ways:
- Without an additional argument—the image will become twice as small in width and height
- Sending 1 as an argument will make the height twice as small
- Sending 2 as an argument will make the width twice as small
Let's run a demo. Try sending 1 as an additional argument so that we decrease the height by 50%:
Consider the following code:
using Images
source_image = load("sample-images/cats-3061372_640.jpg");
resized_image = restrict(source_image, 1); # height
imshow(resized_image);