PIL是Python Imaging Library,它為python解釋器提供了圖像編輯函數。PIL.Image.copy()方法將圖像複製到另一個圖像對象,該方法在我們既需要複製圖像又要保留原始圖像時很有用。
用法:Image.copy() 參數: no arguments 返回: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()
輸出:
相關用法
- Python shutil.copy()用法及代碼示例
- Python list copy()用法及代碼示例
- Python set copy()用法及代碼示例
- Python Dictionary copy()用法及代碼示例
- Python Numpy matrix.copy()用法及代碼示例
- Python Pandas Index.copy()用法及代碼示例
- Python Pandas TimedeltaIndex.copy用法及代碼示例
- Python numpy.ndarray.copy()用法及代碼示例
- Python Pandas tseries.offsets.BusinessHour.copy用法及代碼示例
注:本文由純淨天空篩選整理自ravikishor大神的英文原創作品 Python PIL | copy() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。