對于文檔尚未移植或編寫的模塊,可以在此處找到參考。
exceptionPIL.
UnidentifiedImageError
?基類:OSError
在 PIL.Image.open()
如果圖像無法打開和識別。
解析X位圖分布格式(BDF)
classPIL.BdfFontFile.
BdfFontFile
(fp)
?基類:PIL.FontFile.FontFile
X11 BDF格式的字體文件插件。
PIL.BdfFontFile.
bdf_char
(f)
?classPIL.ContainerIO.
ContainerIO
(file, offset, length)
?基類:object
提供對現(xiàn)有文件(例如TAR文件)的一部分的讀訪問的file對象。
isatty
()
?read
(n=0)
?讀取數(shù)據(jù)。
n -- 要讀取的字節(jié)數(shù)。如果省略或為零,則讀取直到區(qū)域結(jié)束。
8位字符串。
readline
()
?閱讀一行文字。
8位字符串。
readlines
()
?閱讀多行文本。
8位字符串的列表。
seek
(offset, mode=0)
?移動文件指針。
offset -- 偏移量(字節(jié))。
mode -- 開始位置。區(qū)域開始使用0,當(dāng)前偏移使用1,區(qū)域結(jié)束使用2。不能將指針移動到定義區(qū)域之外。
tell
()
?獲取當(dāng)前文件指針。
從區(qū)域開始的偏移量,以字節(jié)為單位。
classPIL.FontFile.
FontFile
?基類:object
柵格字體文件處理程序的基類。
bitmap
= None
?compile
()
?創(chuàng)建度量和位圖
save
(filename)
?保存字體
PIL.FontFile.
puti16
(fp, values)
?寫入網(wǎng)絡(luò)順序(big-endian)16位序列
無法自動識別此格式,因此該類未注冊為與一起使用?
PIL.Image.open()
?. 要打開gd文件,請使用?PIL.GdImageFile.open()
?而是函數(shù)。
GD格式不是為數(shù)據(jù)交換而設(shè)計的。此實現(xiàn)僅用于方便和演示目的。
classPIL.GdImageFile.
GdImageFile
(fp=None, filename=None)
?基類:PIL.ImageFile.ImageFile
GD未壓縮格式的圖像插件。請注意,標(biāo)準(zhǔn)不支持此格式 PIL.Image.open()
功能。要使用此插件,必須導(dǎo)入 PIL.GdImageFile
模塊并使用 PIL.GdImageFile.open()
功能。
format
= 'GD'
?format_description
= 'GD uncompressed images'
?PIL.GdImageFile.
open
(fp, mode='r')
?從gd圖像文件加載紋理。
filename -- gd文件名或打開的文件句柄。
mode -- 可選模式。在這個版本中,如果給出了模式參數(shù),那么它必須是“r”。
一個Image實例。
OSError -- 如果無法讀取圖像。
將曲線段轉(zhuǎn)換為調(diào)色板值的工具(源于GIMP中的相應(yīng)代碼,由federicomena Quintero編寫。有關(guān)詳細信息,請參見GIMP發(fā)行版。)
PIL.GimpGradientFile.
EPSILON
= 1e-10
?classPIL.GimpGradientFile.
GimpGradientFile
(fp)
?基類:PIL.GimpGradientFile.GradientFile
GIMP漸變格式的文件處理程序。
classPIL.GimpGradientFile.
GradientFile
?基類:object
getpalette
(entries=256)
?gradient
= None
?PIL.GimpGradientFile.
SEGMENTS
= [<function linear>, <function curved>, <function sine>, <function sphere_increasing>, <function sphere_decreasing>]
PIL.GimpGradientFile.
curved
(middle, pos)
?PIL.GimpGradientFile.
linear
(middle, pos)
?PIL.GimpGradientFile.
sine
(middle, pos)
?PIL.GimpGradientFile.
sphere_decreasing
(middle, pos)
?PIL.GimpGradientFile.
sphere_increasing
(middle, pos)
?classPIL.GimpPaletteFile.
GimpPaletteFile
(fp)
?基類:object
GIMP調(diào)色板格式的文件處理程序。
getpalette
()
?rawmode
= 'RGB'
?(實驗性)WCK風(fēng)格的繪圖界面操作
參見?
?PIL.ImageDraw?
?
classPIL.ImageDraw2.
Pen
(color, width=1, opacity=255)
?基類:object
存儲輪廓顏色和寬度。
classPIL.ImageDraw2.
Brush
(color, opacity=255)
?基類:object
存儲填充顏色
classPIL.ImageDraw2.
Font
(color, file, size=12)
?基類:object
存儲TrueType字體和顏色
classPIL.ImageDraw2.
Draw
(image, size=None, color=None)
?基類:object
(實驗)WCK風(fēng)格的繪圖界面
flush
()
render
(op, xy, pen, brush=None)
?settransform
(offset)
?設(shè)置變換偏移。
arc
(xy, start, end, *options)
?在給定的邊界框內(nèi),在起始角和結(jié)束角之間繪制圓?。▓A輪廓的一部分)。
參見?
PIL.ImageDraw.ImageDraw.arc()
?
chord
(xy, start, end, *options)
?等同于 arc()
,但用直線連接端點。
參見
PIL.ImageDraw.ImageDraw.chord()
ellipse
(xy, *options)
?在給定的邊界框內(nèi)繪制橢圓。
參見?
PIL.ImageDraw.ImageDraw.ellipse()
?
line
(xy, *options)[源代碼]
?在中的坐標(biāo)之間繪制一條線 xy
名單。
參見PIL.ImageDraw.ImageDraw.line()
pieslice
(xy, start, end, *options)
?與圓弧相同,但也在端點和邊界框中心之間繪制直線。
參見?
PIL.ImageDraw.ImageDraw.pieslice()
?
polygon
(xy, *options)
?繪制多邊形。
多邊形輪廓由給定坐標(biāo)之間的直線以及最后一個坐標(biāo)和第一個坐標(biāo)之間的直線組成。
參見PIL.ImageDraw.ImageDraw.polygon()
rectangle
(xy, *options)
?繪制矩形。
參見PIL.ImageDraw.ImageDraw.rectangle()
text
(xy, text, font)
?在給定位置繪制字符串。
參見PIL.ImageDraw.ImageDraw.text()
textsize
(text, font)
?返回給定字符串的大小(像素)。
參見PIL.ImageDraw.ImageDraw.textsize()
classPIL.ImageTransform.
AffineTransform
(data)
?基類:PIL.ImageTransform.Transform
定義仿射圖像轉(zhuǎn)換。
這個函數(shù)采用一個6元組(a、b、c、d、e、f),其中包含來自仿射變換矩陣的前兩行。對于輸出圖像中的每個像素(x,y),從輸入圖像中的一個位置(a x+b y+c,d x+e y+f)獲取新值,四舍五入到最近的像素。
此功能可用于縮放、平移、旋轉(zhuǎn)和剪切原始圖像。
見 transform()
matrix -- 包含仿射變換矩陣前兩行的6元組(A、B、C、D、E、F)。
method
= 0
?classPIL.ImageTransform.
ExtentTransform
(data)
?基類:PIL.ImageTransform.Transform
定義轉(zhuǎn)換以從圖像中提取子區(qū)域。
將一個矩形(由兩個角定義)從圖像映射到給定大小的矩形。生成的圖像將包含從角點之間采樣的數(shù)據(jù),這樣輸入圖像中的(x0,y0)將在輸出圖像中結(jié)束于(0,0),而(x1,y1)將在大小上結(jié)束。
此方法可用于裁剪、拉伸、收縮或鏡像當(dāng)前圖像中的任意矩形。它比裁剪稍慢,但大約和相應(yīng)的調(diào)整大小操作一樣快。
見 transform()
bbox -- 一個4元組(X0、Y0、X1、Y1),指定輸入圖像坐標(biāo)系中的兩個點。見 坐標(biāo)系 .
method
= 1
?classPIL.ImageTransform.
MeshTransform
(data)
?基類:PIL.ImageTransform.Transform
定義網(wǎng)格圖像轉(zhuǎn)換。網(wǎng)格變換由一個或多個單獨的四元變換組成。
見 transform()
data -- (bbox,quad)元組的列表。
method
= 4
?classPIL.ImageTransform.
QuadTransform
(data)
?基類:PIL.ImageTransform.Transform
定義四圖像轉(zhuǎn)換。
將圖像中的四邊形(由四個角定義的區(qū)域)映射到給定大小的矩形。
見 transform()
xy -- 一個8元組(X0、Y0、X1、Y1、X2、Y2、X3、Y3),包含源四邊形的左上角、左下角、右下角和右上角。
method
= 3
?classPIL.ImageTransform.
Transform
(data)
?基類:PIL.Image.ImageTransformHandler
getdata
()
?transform
(size, image, **options)
?classPIL.PaletteFile.
PaletteFile
(fp)
?基類:object
Teragon樣式調(diào)色板文件的文件處理程序。
getpalette
()
?rawmode
= 'RGB'
?classPIL.PcfFontFile.
PcfFontFile
(fp, charset_encoding='iso8859-1')
?基類:PIL.FontFile.FontFile
X11 PCF格式的字體文件插件。
name
= 'name'
?PIL.PcfFontFile.
sz
(s, o)
?classPIL.PngImagePlugin.
iTXt
(text, lang=None, tkey=None)
?基類:str
字符串的子類,允許itxt塊在保留額外信息的同時看起來像字符串
__new__
(cls, text, lang, tkey)
?value -- 此鍵的值
lang -- 語言代碼
tkey -- UTF-8版本的秘鑰名稱
classPIL.PngImagePlugin.
PngInfo
?基類:object
PNG 塊容器(與 save(pnginfo=) 一起使用)
add
(cid, data)附加任意塊。小心使用。
cid -- 字節(jié)字符串,4個字節(jié)長。
data -- 編碼數(shù)據(jù)的字節(jié)字符串
add_itxt
(key, value, lang='', tkey='', zip=False)
?附加一個itxt塊。
key -- latin-1 可編碼文本鍵名
value -- 此鍵的值
lang -- 語言代碼
tkey --UTF-8 版本的密鑰名稱
zip -- 壓縮標(biāo)志
add_text
(key, value, zip=False)
?附加一個文本塊。
key -- latin-1 可編碼文本鍵名
value -- 此鍵、文本或 PIL.PngImagePlugin.iTXt
實例的值
zip -- 壓縮標(biāo)志
classPIL.TarIO.
TarIO
(tarfile, file)
?基類:PIL.ContainerIO.ContainerIO
提供對TAR文件中給定成員的讀訪問的文件對象。
close
()
?本閱讀器基于可從以下網(wǎng)站獲得的規(guī)范:https://www.flipcode.com/archives/Quake_2_BSP_File_Format.shtml并用google找到的幾個示例文件進行了測試。
此格式無法自動識別,因此閱讀器未注冊使用PIL.Image.open()
. 要打開 WAL 文件,請改用該PIL.WalImageFile.open()
函數(shù)。
PIL.WalImageFile.
open
(filename)
?從Quake2 Wal紋理文件加載紋理。
默認情況下,Quake2 標(biāo)準(zhǔn)調(diào)色板附加到紋理。要覆蓋調(diào)色板,請使用PIL.Image.Image.putpalette()
方法。
filename -- wal文件名或打開的文件句柄。
一個Image實例。
更多建議: