我可以使用以下代码在基本图像上绘制一个黑色条(或矩形):
base_width, base_height = img.size
background = Image.new('RGBA', (base_width, base_height/3),(0,0,0,146))
offset = (0,base_height/2)
img.paste(background,offset,mask=background)结果:

但是,如何扩展图像的高度,使所述的黑带显示在图像的底部边框之下,在图像本身之外?
如果我在上面的代码中移动offset,那么黑带就不能移动到基本图像的边框之外,所以这不是一个可行的解决方案。
发布于 2017-05-08 10:34:36
有一种方法:
new_img的(base_width, base_height + background.height)img粘贴到new_img at (0, 0)background粘贴到(0, base_height)的new_img中https://stackoverflow.com/questions/43831842
复制相似问题