Home>
I generated a character image with python3.7 pillow, but I would like to adjust the size so that it matches the vertical width, but the generated image is stacked in a flat manner from the 0 point. I'm in trouble.
At first, I tried to change the vertical/horizontal size of the image with img.resize or img.thumbnail, but I changed the original size from 128x128, so I asked if it was fundamentally different.
txt = "That"
fontsize = 30
img = Image.new ('RGBA', (128, 128), (255, 255, 255))
draw = ImageDraw.Draw (img)
font_path = "/static/font/font.otf"
font = ImageFont.truetype (font_path, fontsize)
draw = ImageDraw.Draw (img)
draw.text ((0, 0), txt, fill = '# 000', font = font)
img.save ('hello.png')
Above output contents
Does it extend as follows? I want the image to be
-
Answer # 1
Related articles
- how to save the image ocr result file in python
- python - i want to create a contour image
- python - tkinter photo image question
- python - if you enter pip3 install pillow, you will see something like this
- python3 tkinter i want to be able to input only character strings in a fixed format
- python - image recognition using cnn keras multiple inputs
- python - i want to read an image and display it
- python - i want to divide the read image into pixels and label them
- python - i want to display an image with pysimplegui, but an error occurs
- python - image is not saved even though there is no opencv error
- about processing to exclude the character string group specified from list in python
- python - i want to convert a black and white image to an arbitrary color image
- python - error in image binarization using cv2adaptivethreshold function
- about image output of python
- python - image cannot be read by opencv
- python - when i tried to inflate the image, i couldn't read the image
- python - i want to know how to assign the image file name in the same directory to a variable and read the image from there
- python - about image deletion in django
- python - image recognition with keras
- python - image display from the variable to which the file name is assigned
Trends
What about this? Although the resolution drops considerably.
If you use the ratio as follows, you can also generate without reducing the resolution.