PIL是Python Imaging Library,它为python解释器提供了图像编辑函数。
ImageChops.screen()方法-
此方法用于将两个倒置的图像彼此叠加。
用法: ImageChops.screen(image1, image2) 参数: image1 first image image2 second image 返回值: An Image
# This will import Image and ImageChops modules 
from PIL import Image, ImageChops 
  
# Opening Images 
im = Image.open(r"C:\Users\Admin\Pictures\images.png") 
im2 = Image.open(r"C:\Users\Admin\Pictures\download.PNG") 
  
# superimposing images im and im2 
im3 = ImageChops.screen(im, im2) 
  
# showing resultant image 
im3.show()输出:

ImageChops.offset()方法-
此方法返回图像的副本,其中数据已偏移给定距离。数据环绕边。如果省略yoffset,则假定它等于xoffset。
用法: ImageChops.offset(image1, xoffset, yoffset = None)
参数:
image:它是提供偏移量的图像
xoffset:水平距离
yoffset:它是垂直距离,如果省略,则将两个距离设置为相同。
返回值:原始图像的副本
# This will import Image and ImageChops modules 
from PIL import Image, ImageChops 
  
# Opening Images 
im = Image.open(r"C:\Users\Admin\Pictures\images.png") 
im2 = Image.open(r"C:\Users\Admin\Pictures\download.PNG") 
  
# Here, xoffset is given 100 
# yoffset wil automaticallly set to 100 
im3 = ImageChops.offset(im, 140) 
  
# showing resultant image 
im3.show()输出:

相关用法
- Python next()用法及代码示例
 - Python os.dup()用法及代码示例
 - Python set()用法及代码示例
 - Python hash()用法及代码示例
 - Python os.times()用法及代码示例
 - Python PIL BoxBlur()用法及代码示例
 - Python sympy.ones()用法及代码示例
 - Python dict pop()用法及代码示例
 - Python sys.getdefaultencoding()用法及代码示例
 - Python Numpy np.fft()用法及代码示例
 - Python os.setgroups()用法及代码示例
 - Python os.getgroups()用法及代码示例
 - Python PyTorch tan()用法及代码示例
 - Python object()用法及代码示例
 
注:本文由纯净天空筛选整理自sanjeev2552大神的英文原创作品 Python PIL | ImageChops.screen() and ImageChops.offset() method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
