发布于 2015-09-11 16:11:00 | 190 次阅读 | 评论: 0 | 来源: 网络整理

The ImagePalette module contains a class of the same name to represent the color palette of palette mapped images.

注解

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)[source]

Color palette for palette mapped images

getcolor(color)[source]

Given an rgb tuple, allocate palette entry.

警告

This method is experimental.

getdata()[source]

Get palette contents in format suitable # for the low-level im.putpalette primitive.

警告

This method is experimental.

save(fp)[source]

Save palette to text file.

警告

This method is experimental.

tobytes()[source]

Convert palette to bytes.

警告

This method is experimental.

tostring()

Convert palette to bytes.

警告

This method is experimental.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务