Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Python DIY a photo wall

Shulou Source: shulou.com Published: 2022-06-02 02:47:03 10月03日 Update

This article mainly explains "how to use Python DIY a photo wall", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use Python DIY as a photo wall.

DIY a photo wall for her with Python

As perceptual creatures, human beings have an innate desire to express themselves. A wall, like a blank piece of paper or a canvas, attracts us to fill in our emotions and thoughts.

Today, with you through a small piece of code, for programmers infatuated with Python, made a Python family photo (a total of 65 books), covering the scope of crawlers, data analysis, Web development, text processing, machine learning, etc., and thank the Machinery Industry Press and Electronic Industry Press for the photos provided.

Big data Digest

The details are as follows:

From PIL import Image

Import os,sys

Mw = 100

Ms = 20

Msize = mw*ms

# choose a canvas and determine the size of the canvas

ToImage = Image.new ('RGBA', (2000 Jol 2000))

For y in range (1 ~ 21):

For x in range (1 ~ 21):

Try:

# Select the photo, according to the style you want, select it in turn

FromImage = Image.open (r "C:/Users/Administrator/Desktop/LX/%s.jpg"% str (ms* (ymer1) + x))

# paste the photo, paste the photo into the design location

FromImage = fromImage.resize (100100), Image.ANTIALIAS)

ToImage.paste (fromImage, ((XMUI 1) * mw, (YMUI 1) * mw))

Except IOError:

Pass

ToImage.show ()

ToImage.save ('CureGap _ UsersActuator _ Desktopmax _ LX.png`)

At this point, I believe you have a deeper understanding of "how to use Python DIY a photo wall". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Photos canvas learning code content publishing industry data publishing practical deeper inborn one side human location whole family key interest at the same time size Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Microsoft MariaDB Linux macOS