4.3.0¶
API Changes¶
Deprecations¶
Several undocumented functions in ImageOps have been deprecated:
gaussian_blur
, gblur
, unsharp_mask
, usm
and
box_blur
. Use the equivalent operations in ImageFilter
instead. These functions will be removed in a future release.
TIFF Metadata Changes¶
TIFF tags with unknown type/quantity now default to being bare values if they are 1 element, where previously they would be a single element tuple. This is only with the new api, not the legacy api. This normalizes the handling of fields, so that the metadata with inferred or image specified counts are handled the same as metadata with count specified in the TIFF spec.
The
PhotoshopInfo
,XMP
, andJPEGTables
tags now have a defined type (bytes) and a count of 1.The
ImageJMetaDataByteCounts
tag now has an arbitrary number of items, as there can be multiple items, one for UTF-8, and one for UTF-16.
Core Image API Changes¶
These are internal functions that should not have been used by user code, but they were accessible from the python layer.
Debugging code within Image.core.grabclipboard
was removed. It had been
marked as will be removed in future versions
since PIL. When enabled, it
identified the format of the clipboard data.
The PIL.Image.core.copy
and PIL.Image.Image.im.copy2
methods
have been removed.
The PIL.Image.core.getcount
methods have been removed, use
PIL.Image.core.get_stats()['new_count']
property instead.
API Additions¶
Get One Channel From Image¶
A new method PIL.Image.Image.getchannel()
has been added to
return a single channel by index or name. For example,
image.getchannel("A")
will return alpha channel as separate image.
getchannel
should work up to 6 times faster than
image.split()[0]
in previous Pillow versions.
Box Blur¶
A new filter, PIL.ImageFilter.BoxBlur
, has been
added. This is a filter with similar results to a Gaussian blur, but
is much faster.
Partial Resampling¶
Added new argument box
for PIL.Image.Image.resize()
. This
argument defines a source rectangle from within the source image to be
resized. This is very similar to the image.crop(box).resize(size)
sequence except that box
can be specified with subpixel accuracy.
New Transpose Operation¶
The Image.TRANSVERSE
operation has been added to
PIL.Image.Image.transpose()
. This is equivalent to a transpose
operation about the opposite diagonal.
Multiband Filters¶
There is a new PIL.ImageFilter.MultibandFilter
base class
for image filters that can run on all channels of an image in one
operation. The original PIL.ImageFilter.Filter
class
remains for image filters that can process only single band images, or
require splitting of channels prior to filtering.
Other Changes¶
Loading 16-bit TIFF Images¶
Pillow now can read 16-bit multichannel TIFF files including files with alpha transparency. The image data is truncated to 8-bit precision.
枕头现在可以读取整数单通道TIFF文件的16位有符号。的图像数据被晋升为32位进行存储和处理。
SGI图片¶
Pillow can now read and write uncompressed 16-bit multichannel SGI images to and from RGB and RGBA formats. The image data is truncated to 8-bit precision.
枕现在可以读取RLE在8位和16位精度编码SGI图像。
性能¶
本新闻稿中包含一些性能改进:
许多存储器带宽有界的操作,如农作物,图像分配,转换,分割成带和从频带合并均达到2倍速度更快。
多通道图像(例如,RGB)的升频是由5-10%加速
JPEG加载加速到15%和JPEG使用的libjpeg最近涡轮增压的版本时,省电可达20%。
Image.transpose
通过使用缓存友好算法有所加快15%以上。基于卷积核ImageFilters是显著更快由于新MultibandFilter功能。
All memory allocation for images is now done in blocks, rather than falling back to an allocation for each scan line for images larger than the block size.
CMYK Conversion¶
The basic CMYK->RGB conversion has been tweaked to match the formula from Google Chrome. This produces an image that is generally lighter than the previous formula, and more in line with what color managed applications produce.