fixed rotating vertical images
This commit is contained in:
parent
ba1d12b206
commit
891e323094
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
**/__pycache__/**
|
||||||
|
*.pyc
|
Binary file not shown.
@ -1,6 +1,7 @@
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
from PIL import ImageDraw
|
from PIL import ImageDraw
|
||||||
from PIL import ImageFont
|
from PIL import ImageFont
|
||||||
|
from PIL import ImageOps
|
||||||
|
|
||||||
|
|
||||||
def watermark_text(input_image_path: str,
|
def watermark_text(input_image_path: str,
|
||||||
@ -20,6 +21,7 @@ def watermark_text(input_image_path: str,
|
|||||||
yellow = (237,255,33)
|
yellow = (237,255,33)
|
||||||
font = ImageFont.truetype(font_path, size, encoding='unic')
|
font = ImageFont.truetype(font_path, size, encoding='unic')
|
||||||
drawing.text(pos, text=text, fill=yellow, font=font, anchor="la")
|
drawing.text(pos, text=text, fill=yellow, font=font, anchor="la")
|
||||||
|
photo = ImageOps.exif_transpose(photo)
|
||||||
if show:
|
if show:
|
||||||
photo.show()
|
photo.show()
|
||||||
photo.save(output_image_path)
|
photo.save(output_image_path)
|
||||||
|
BIN
samples/IMG_0986.jpg
Normal file
BIN
samples/IMG_0986.jpg
Normal file
Binary file not shown.
After ![]() (image error) Size: 4.0 MiB |
BIN
samples/IMG_0986_wm.jpg
Normal file
BIN
samples/IMG_0986_wm.jpg
Normal file
Binary file not shown.
After ![]() (image error) Size: 836 KiB |
Loading…
x
Reference in New Issue
Block a user