ImagePalette
Module¶
The ImagePalette
module contains a class of the same name to
represent the color palette of palette mapped images.
Note
This module was never well-documented. It hasn’t changed since 2001, though, so it’s probably safe for you to read the source code and puzzle out the internals if you need to.
The ImagePalette
class has several methods,
but they are all marked as “experimental.” Read that as you will. The
[source]
link is there for a reason.
-
class
PIL.ImagePalette.
ImagePalette
(mode='RGB', palette=None, size=0)¶ Color palette for palette mapped images
-
getcolor
(color)¶ Given an rgb tuple, allocate palette entry.
Warning
This method is experimental.
-
getdata
()¶ Get palette contents in format suitable # for the low-level
im.putpalette
primitive.Warning
This method is experimental.
-
save
(fp)¶ Save palette to text file.
Warning
This method is experimental.
-
tobytes
()¶ Convert palette to bytes.
Warning
This method is experimental.
-
tostring
()¶ Convert palette to bytes.
Warning
This method is experimental.
-