Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark, in light modeAuto light/dark, in dark modeSkip to content
Pillow (PIL Fork) 12.0.0 documentation
Light LogoDark Logo
Pillow (PIL Fork) 12.0.0 documentation
Back to top

ImageEnhance module

TheImageEnhance module contains a number of classes that can be usedfor image enhancement.

Example: Vary the sharpness of an image

fromPILimportImageEnhanceenhancer=ImageEnhance.Sharpness(image)foriinrange(8):factor=i/4.0enhancer.enhance(factor).show(f"Sharpness{factor:f}")

Also see theenhancer.py demo program in theScripts/directory.

Classes

All enhancement classes implement a common interface, containing a singlemethod:

classPIL.ImageEnhance._Enhance[source]
enhance(factor)[source]

Returns an enhanced image.

Parameters:

factor – A floating point value controlling the enhancement.Factor 1.0 always returns a copy of the original image,lower factors mean less color (brightness, contrast,etc), and higher values more. There are no restrictionson this value.

classPIL.ImageEnhance.Color(image)[source]

Adjust image color balance.

This class can be used to adjust the colour balance of an image, in amanner similar to the controls on a colour TV set. Anenhancement factor of 0.0 gives a black andwhite image. A factor of 1.0 gives the original image.

classPIL.ImageEnhance.Contrast(image)[source]

Adjust image contrast.

This class can be used to control the contrast of an image, similar to thecontrast control on a TV set. Anenhancement factor of 0.0 gives a solid grayimage, a factor of 1.0 gives the original image, and greater valuesincrease the contrast of the image.

classPIL.ImageEnhance.Brightness(image)[source]

Adjust image brightness.

This class can be used to control the brightness of an image. Anenhancement factor of 0.0 gives a black image,a factor of 1.0 gives the original image, and greater values increase thebrightness of the image.

classPIL.ImageEnhance.Sharpness(image)[source]

Adjust image sharpness.

This class can be used to adjust the sharpness of an image. Anenhancement factor of 0.0 gives a blurredimage, a factor of 1.0 gives the original image, and a factor of 2.0 givesa sharpened image.

On this page

[8]ページ先頭

©2009-2025 Movatter.jp