Drawing, Cropping and Collage making using Python code

Hey guys in this block we are gonna draw, crop and create collage through python code.
For this we are gonna use :
Python as language
Jupyter notebook
2 images with a face

Drawing any Image:
When we look to any image in phone or laptop it seems as if there is some high graphic tech. used for storing that image.
But actually an image is stored in any system in form of array.
So by use of these arrays only we are gonna create a hut on a blank black sheet.
So lets create a hut on a blank black sheet of shape — (1000, 1000, 3)
For creating a hut we need to use cv2 library of python.
So firstly import library cv2.
Now lets upload our empty sheet in our program
Or we can create our own image using numpy library.
After uploading lets check our sheet saved by name “test”

Our sheet is now like this :

As we can see shape of our image is = (1000, 1000, 3)
Which means this pic is totally divided into 1000 rows and 1000 columns.

Now lets use concept of arrays to draw a hut.
To draw straight lines of a hut we use :

Now if we see our image it looks like :

Now our only task left is to draw all triangular straight line so for that we can use the code as :

Now if we see our image it looks like :

Now if we want to put colors in this image we can use the code as :

Now if we want to put colors in this image we can use the code as :

Now our final image created will be :

Cropping the Images :

In this part we will try to crop two images and then exchange the cropped part of each image.
For this we need to firstly upload two images in our RAM.

I am student of GLA Student