我有成千上万的图像。我想批量编辑它们,在图片底部添加一个包含Instagram,Facebook和Twitter帐户用户名的条带。
示例图片位于:https://data.whicdn.com/images/254261469/large.jpg
可以使用Python以编程方式添加相同的条带。
答案 0 :(得分:0)
给你一些开始的东西。下面的示例将使用Pillow / PIL库将图像粘贴到另一个图像中。它将徽标图像粘贴在原始图像左上角的(25,25)处并保存。
from PIL import Image
# Load the image you want to modify
image = Image.open('large.jpg')
print("Image size is ", image.size)
# Load the logo you want to paste in
logo = Image.open('logo.png')
# Decide what size you need possibly based on the first image?
# Here we are just reducing the size so it has a higher chance to fit
logo = logo.resize((logo.size[0] // 4, logo.size[1] // 4))
# Paste the logo into the image
image.paste(logo, (25, 25))
# Save the new image
image.save("test.jpg", format='jpeg')
您需要了解的其他事项: