Joke Collection Website - Blessing messages - Making Posters on Canvas —— How to draw May Day Posters in python

Making Posters on Canvas —— How to draw May Day Posters in python

Canva draws poster 0 1: canvas draws pictures to solve the problem of slight blur after export. Besides,

Both the img tag and the image in js suggest adding the attribute of crossorigin="anonymous ".

* * Note: * * Some netizens' comments ('crossOrigin',' anonymous') must have been written before you assigned the value, so the landlord wrote it incorrectly. Please check this link, #27260385.

The effect diagram is as follows:

Fuzzy online demonstration

Solution:

1. First, get the canvas object:

2. Get the pixel ratio and enlarge the width and height of the canvas. The magnification ratio is DevicePixellatio/WebkitBackingstorePixellatio, and we have written a compatible method.

3. Scale the canvas according to the actual rendering scale.

Pay attention to basic knowledge points:

To set the size of the canvas, use and;

To set the actual rendering size of the canvas, simply use the style property or the width and height set by CSS to scale the canvas.

draw pictures

The effect diagram is as follows

Online demonstration without ambiguity after optimization

Reference link:

A cross-domain problem about image accessing pictures,

Solve the problem of converting a picture from canvas to base64 and report an error: uncaughtdomexception: failed to execute "Toda Aurl" on "htmlcanvas element": The trained canvas may not be exported.

Solves the problem that the canvas is blurred under the high-definition screen,

How to draw May Day posters in python To draw May Day posters in Python, you need to use Python painting galleries, such as matplotlib and Pillow. The following is a simple example to demonstrate how to use Python and Pillow libraries to make May Day posters:

fromPILimportImage,ImageDraw,ImageFont

# Create a blank canvas with a size of 800x600 and a white background color.

canvas=('RGB ',(800,600),(255,255,255))

# Add May Day greetings to the canvas

Font= ('',48)# Set font style and size

Draw= (canvas)

((200, 100),' Happy May Day!' , fill = (0,0,0), font=font)# Set the text position, color and font.

# Add a five-star red flag pattern to the canvas

Flag=('')# Look at the five-star red flag picture.

Flag=((200, 133))# Set the picture size to 200x 133.

(flag, (300,300)) # Paste the picture on the canvas.

# Save and display canvas

('')

()

In this example, we first created a blank canvas with the size of 800x600 using the Pillow library, and added the May Day holiday greetings and the five-star red flag pattern to the canvas. Finally, use the save () method to save the canvas as a picture in PNG format, and use the show () method to display the picture. In practice, you need to modify the code according to your own needs, such as changing greetings, adjusting font size and color, and changing pictures.

What software brand is canvas? Model: Huawei mate book 15.

System: Windows 1 1

Canvas is a vector drawing software. Is an online graphic design tool that supports multiple platforms (Web, iPhone, iPAD and Android).

Canva provides rich copyrighted pictures, original illustrations and various high-quality design templates. Users can make posters, resumes, banners, business cards and other designs in a few minutes just by modifying their favorite templates.

Software programs can seamlessly integrate painting, image editing and web design tools, and the software can export paintings (including animations and network-ready files) in various formats. It bundles many tools for bitmap editing, display, network graphics and vector drawing in the clip library. Because canvas seamlessly integrates the functions of vector illustration, image editing and web publishing, it is the best and is loved by a large number of users.