How to Concatenate image using Pillow in Python ? Last Updated : 07 Apr, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Prerequisites: Python Pillow Concatenate image means joining of two images. We can merge any image whether it has different pixels, different image formats namely, 'jpeg', 'png', 'gif', 'tiff', etc. In python, we can join two images using the Python image library also known as the pillow library. In this article, we will see how the concatenation of images is done. Concatenation of images can be done in two ways : HorizontalVerticalConcatenating images horizontally Approach: Import moduleOpen the imagesResize the image using Resize() function. Both the resize images should be of the same width and height so that their aspect ratio is intact and can be pasted into the new background image.To create a new image it has a new() function which has 3 parameters ("mode",(size),color)Paste the image to new image using paste() Program: Python3 # library from PIL import Image import matplotlib.pyplot as plt # opening up of images img = Image.open("logo.png") img1 = Image.open("logo2.png") img.size img1.size img_size = img.resize((250, 90)) img1_size = img1.resize((250, 90)) # creating a new image and pasting # the images img2 = Image.new("RGB", (500, 90), "white") # pasting the first image (image_name, # (position)) img2.paste(img_size, (0, 0)) # pasting the second image (image_name, # (position)) img2.paste(img1_size, (250, 0)) plt.imshow(img2) Output : Concatenating images vertically The whole code is the same as horizontal but the only change is that in horizontal we double the width and the height is same but in vertical we make the size of width same, but we double the height. Approach: Import the libraries for image processing.Use Image.open() to open the library.Use img.size to know the size of the image.Use img.resize((width,height)) to resize the image.Both the images should be of same size.Create a new image using new() and pass the 3 parameters"mode",size,"color").Size in new image should be (width, 2*height).After the creation of new image, paste the first image by using paste() and pass the parameter(img_resize,(position)) #position(0,0)After pasting the first image, paste the second image using paste and pass the parameter(img1_reszie, (position)). In position, width would be the same but the height would be the last position of the first image's height. . #position=(0,180)Use plt.imshow(img2) to show the concatenate of images. Program: Python3 # library from PIL import Image import matplotlib.pyplot as plt # opening up of images img = Image.open("logo.png") img1 = Image.open("logo2.png") img.size img1.size img_size = img.resize((250, 90)) img1_size = img1.resize((250, 90)) # creating a new image and pasting the # images img2 = Image.new("RGB", (250, 180), "white") # pasting the first image (image_name, # (position)) img2.paste(img_size, (0, 0)) # pasting the second image (image_name, # (position)) img2.paste(img1_size, (0, 90) plt.imshow(img2) Output: Comment More infoAdvertise with us Next Article Change image resolution using Pillow in Python K kanishkmadan2000 Follow Improve Article Tags : Python Python-pil Practice Tags : python Similar Reads Concatenate images using OpenCV in Python To concatenate images vertically and horizontally with Python, cv2 library comes with two functions as: hconcat(): It is used as cv2.hconcat() to concatenate images horizontally. Here h means horizontal.vconcat(): It is used as cv2.vconcat() to concatenate images vertically. Here v means vertical.Im 3 min read How to add text on an image using pillow in Python ? Prerequisites: PIL In this article we'll see how we can add text on an image using the pillow library in Python. Python Imaging Library (PIL) is the de facto image processing package for Python language. It incorporates lightweight image processing tools that aids in editing, creating and saving ima 2 min read Change image resolution using Pillow in Python Prerequisites: Python pillow PIL is the Python Imaging Library which provides the python interpreter with an in-depth file format support, an efficient internal representation, and fairly powerful image processing capabilities. Changing the resolution of an image simply means reducing or increasing 2 min read How to Convert Image to PDF in Python? img2pdf is an open source Python package to convert images to pdf format. It includes another module Pillow which can also be used to enhance image (Brightness, contrast and other things) Use this command to install the packages pip install img2pdf  Below is the implementation: Image can be convert 1 min read Python | Crop image using pillow In this article, we will learn to crop an image using pillow library. Cropping an image means to select a rectangular region inside an image and removing everything outside the rectangle. To crop an image we make use of crop() method on image objects. Syntax : IMG.crop(box_tuple) Parameters : Image_ 1 min read Convert an image into jpg format using Pillow in Python Let us see how to convert an image into jpg format in Python. The size of png is larger when compared to jpg format. We also know that some applications might ask for images of smaller sizes. Hence conversion from png(larger ) to jpg(smaller) is needed. For this task we will be using the Image.conve 2 min read Like