Python implements horizontal stitching of pictures

The examples in this article share the specific code of python to realize horizontal stitching of pictures for your reference. The specific content is as follows

import os
from PIL import Image
 
# The size of a single picture is 150*150
UNIT_SIZE =150
TARGET_WIDTH =5* UNIT_SIZE
 
path ="The address of the folder where pictures are stored"
images =[]
imagefile =[]
# Store all picture file names
for root, dirs, files in os.walk(path):for f in files:
 images.append(f)
# I am here to stitch five pictures horizontally
for i inrange(5):
 imagefile.append(path+'/'+images[i])
target = Image.new('RGB',(TARGET_WIDTH, UNIT_SIZE))
left =0
right = UNIT_SIZE
for image in imagefile:
 # print(image)
 # Copy the existing picture to the new above parameters are picture file and copy location(Upper left corner,Bottom right corner)
 target.paste(Image.open(image),(left,0, right, UNIT_SIZE))
 left += UNIT_SIZE
 right += UNIT_SIZE
 # Picture quality 0~100
 quantity_value =100
 target.save(path+'/end.jpg', quantity = quantity_value)

Picture effect achieved (picture from unsplash)

This article has been included in the topic "Python Image Processing Operations", welcome to click to learn more exciting content.

The above is the whole content of this article, I hope it will be helpful to everyone's study.

Recommended Posts

Python implements horizontal stitching of pictures
Python implements image stitching
Python realizes stitching pictures
Python realizes horizontal and vertical splicing of pictures
Python implements panoramic image stitching
Python implements image stitching function
Python implements alternate execution of two threads
Python implements the sum of fractional sequences
Python- crawl all pictures of a station
7 features of Python3.9
Python implements the shuffling of the cards in Doudizhu
Python implements the source code of the snake game
Python implements Super Mario
Python implements tic-tac-toe game
Python generates connotative pictures
Python implements man-machine gobang
Basics of Python syntax
Python implements scanning tools
Basic syntax of Python
Example of how to automatically download pictures in python
Prettytable module of python
09. Common modules of Python3
Python implements threshold regression
Python implements minesweeper games
Python implements electronic dictionary
Python implements guessing game
Python implements simple tank battle
Consolidate the foundation of Python(7)
Python implements udp chat window
In-depth understanding of python list (LIST)
Subscripts of tuples in Python
Python analysis of wav files
Consolidate the foundation of Python(6)
Python implements a guessing game
Python implements parking management system
Python implements digital bomb game
Python implements TCP file transfer
Analysis of JS of Python crawler
Python numpy implements rolling case
python king of glory wallpaper
OpenCV Python implements puzzle games
Python implements simple tic-tac-toe game
Python implements password strength verification
Python implements car management system
Python implementation of gomoku program
Analysis of Python Sandbox Escape
Some new features of Python 3.10
Deep understanding of Python multithreading
Python implements code block folding
Analysis of Python object-oriented programming
Python implements SMTP mail sending
Python implements multi-dimensional array sorting
How Python implements FTP function
Python implements mean-shift clustering algorithm
python opencv for image stitching
Python implements verification code recognition
Python implements gradient descent method
Python implements text version minesweeper
Python version of OpenCV installation
9 feature engineering techniques of Python
matplotlib of python drawing module