看板 Python 關於我們 聯絡資訊
※ 引述《Lucemia (生の直感、死の予感)》之銘言: : 總之有兩個簡單的作法: : 1. 只存image data 部份 之後要使用時再產生image 物件來用 : ths = [] # 存image data : for ..... : ths.append(Image.open('...').getData()) : 2. 手動將open的file 關閉 : ths = [] # 存image object : for ..... : i = Image.open('...') : f = i.fp # file object : i.load() : f.close() : ths.append(i) : 另外 "list" 是python的關鍵字。 >>> im = Image.open("DSC06637.JPG") >>> print im.fp <open file 'DSC06637.JPG', mode 'rb' at 0x00D352F0> >>> im.load() <PixelAccess object at 0x00C56100> >>> print im.fp None 其實只要 load() 一下就好了啦 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 164.107.239.6