Create an image with characters in python (Japanese)

background

Not so much

work

--Check the location of the font file

$ fc-match -f "%{file}\n" FreeMono 
/System/Library/Fonts/Hiragino Maru Go ProN W4.ttc

--Make an image

from PIL import Image, ImageDraw, ImageFont

font = ImageFont.truetype("/System/Library/Fonts/Hiragino Maru Go ProN W4.ttc", size=60)

def make_image(n):
    im = Image.new("RGB",(300,100),"blue")
    draw = ImageDraw.Draw(im)#Create an ImageDraw instance on im
    draw.text((10,20), f"Free description field{n}", font=font)
    im.save(f"./freetext{n}.jpg ")

for i in range(0,50):
    make_image(i)

--If you want to display it on jupyter notebook

from IPython.display import Image, display_png
display_png(Image('./name1.jpg'))

Deliverables

name46.jpg

freetext1.jpg

reference

Recommended Posts

Create an image with characters in python (Japanese)
Tweet with image in Python
How to create an image uploader in Bottle (Python)
Cut out an image with python
Create an Excel file with Python3
Create a dummy image with Python + PIL.
Quickly create an excel file with Python #python
[Python] Quickly create an API with Flask
Easy image processing in Python with Pillow
Create an English word app with python
Create an app that guesses students with python
Create polka dot wallpaper with Python Image Library
Create SpatiaLite in Python
Create an image composition app with Flask + Pillow
How to crop an image with Python + OpenCV
Create a virtual environment with conda in Python
Image format in Python
Handle zip files with Japanese filenames in Python 3
Segfault Python with 33 characters
Image processing with Python
Create a new page in confluence with Python
Japanese output in Python
[Python] How to handle Japanese characters with openCV
Send an email with Excel attached in Python
Post an article with an image to WordPress with Python
Create an API server quickly with Python + Falcon
Create an animated GIF local server with Python + Flask
Make each PowerPoint page an image file in Python
Japanese can be used with Python in Docker environment
[Python] Get the numbers in the graph image with OCR
Create an image file using PIL (Python Imaging Library).
Convert the image in .zip to PDF with Python
Create miscellaneous Photoshop videos with Python + OpenCV ② Create still image Photoshop
Japanese output when dealing with python in visual studio
Create a fake Minecraft server in Python with Quarry
[Python] Create an infrastructure diagram in 3 minutes using diagrams
Image processing with Python (Part 2)
Send Japanese email with Python3
I wrote python in Japanese
Quicksort an array in Python 3
Create an environment with virtualenv
Scraping with selenium in Python
Create a function in Python
Create a dictionary in Python
Working with LibreOffice in Python
Create an API with Django
Scraping with chromedriver in python
Image editing with python OpenCV
Debugging with pdb in Python
Create 3d gif with python3
Create gif video in Python
Creating an egg with python
Working with sounds in Python
Sorting image files with Python (2)
Scraping with Selenium in Python
Sorting image files with Python (3)
Create Image Viewer with Tkinter
Image processing with Python (Part 1)
Scraping with Tor in Python
Sorting image files with Python
Combined with permutations in Python