📜  Python PIL |复制()方法

📅  最后修改于: 2022-05-13 01:54:33.095000             🧑  作者: Mango

Python PIL |复制()方法

PIL 是Python Imaging Library,它为Python解释器提供了图像编辑功能。 PIL.Image.copy()方法将图像复制到另一个图像对象,当我们需要复制图像同时保留原始图像时,此方法很有用。
Syntax:Image.copy()

Parameters: no arguments

Returns:An image object
# Importing Image module from PIL package
from PIL import Image
  
# creating a image object
im1 = Image.open(r"C:\Users\sadow984\Desktop\i3.PNG")
  
# copying image to another image object
im2 = im1.copy()
  
# shows the copied image
im2.show()

输出:

# Importing Image module from PIL package
from PIL import Image
  
# creating a image object
im1 = Image.open(r"C:\Users\sadow984\Desktop\i3.PNG")
  
# copying image to another image object
im2 = im1.copy()
  
# shows the original image
im1.show()

输出: