How to merge images

How to merge images

         If you would like to merge images into one, you need to calculate the total size of the resulting image by summing the total width or height of the images depending on the merge direction. In the case of the horizontal direction, we will sum images widths and use a direction value equal to `0` in our example, and sum heights for the vertical direction with the value of `1`. Next, create a new merge image with the calculated dimensions and desired background color and place the images to it using draw_image method.