We now have the mask, we will use it on our image to produce the desired result.
Of course, we will apply it on the squared version of our image, the previous
portrait.borders.png file. To blur the image considering the mask, we will
blur option from
-compose. This option can take an argument, the
same kind of argument that the
-blur option takes (the intensity of the
blurred effect). In our case, the intensity should be enough high to reach the
borders of the image. Remember, the blur effect is an operation that take, for
each pixel, an average color of all the pixels around; what I mean by the
intensity of the blur effect is the diameter (in number of pixel) of the
circle where we do this average.
Let’s try with a arbitrary value: 24.
-compose blur \
-set option:compose:args 24 \
It seems that it’s not sufficient, and it already took a long time to generate
the image… Wait! We forget something. It’s an average of colors but we have
only transparent colors on the borders. So there is probably pixels in this
image that have a blurred colored corresponding to the image but with a majority
of transparent color: we do not see it. To only keep the RGB color (which is
the meaningfull information in our picture), we will just remove the
transparency in the image (deactivate the alpha channel).
-alpha off \
There is clearly a problem. The size of our blurred effect was so small that
the pixels on the extrems didn’t beneficied of any color. We need to increase
the value of our argument. This time, we will apply the blurred effect and
remove the transparency in one operation.
-compose blur \
-set option:compose:args 48 \
-alpha on \
We finally have it, the squared portrait.