Deprecated since version 6.1.0.
Implicitly closing the image’s underlying file in
Image.__del__ has been deprecated.
Use a context manager or call
Image.close() instead to close the file in a
im = Image.open("hopper.png") im.save("out.jpg")
with Image.open("hopper.png") as im: im.save("out.jpg")
Calculates and returns the entropy for the image. A bilevel image (mode “1”) is treated as a greyscale (“L”) image by this method. If a mask is provided, the method employs the histogram for those parts of the image where the mask image is non-zero. The mask image must have the same size as the image, and be either a bi-level image (mode “1”) or a greyscale image (“L”).
include_layered_windows parameter has been added to
False. If true, layered windows will be included in the resulting
image on Windows.
A new method to facilitate applying a given function to all frames in an image, or to
all frames in a list of images. The frames are returned as a list of separate images.
ImageSequence.all_frames(im, lambda im_frame: im_frame.rotate(90))
could be used to return all frames from an image, each rotated 90 degrees.
Variation fonts are now supported, allowing for different styles from the same font
ImageFont.FreeTypeFont has four new methods,
PIL.ImageFont.FreeTypeFont.set_variation_by_name() for using named styles, and
PIL.ImageFont.FreeTypeFont.set_variation_by_axes() for using font axes
IOError will be raised if the font is not a variation font. FreeType
2.9.1 or greater is required.
This function is now supported. It returns the contents of an
Image quality for JPEG compressed TIFF¶
The TIFF encoder accepts a
quality parameter for
jpeg compressed TIFF files. A
value from 0 (worst) to 100 (best) controls the image quality, similar to the JPEG
encoder. The default is 75. For example:
im.save("out.tif", compression="jpeg", quality=85)
Respect PKG_CONFIG environment variable when building¶
This variable is commonly used by other build systems and using it can help with
cross-compiling. Falls back to
pkg-config as before.