Python Imaging Library---PIT

Posted 流浪若相惜

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python Imaging Library---PIT相关的知识,希望对你有一定的参考价值。

PIT


相较于OpenCV,PIT是一种轻量级别的python图像处理工具。其功能介绍如 官网所说:
The Python Imaging Library adds image processing capabilities to your Python interpreter.
This library provides extensive file format support, an efficient internal representation, and fairly powerful image processing capabilities.
The core image library is designed for fast access to data stored in a few basic pixel formats. It should provide a solid foundation for a general image processing tool.

PIT内部功能,请具体查看参考文档

Image Modual

The Image module provides a class with the same name which is used to represent a PIL image. The module also provides a number of factory functions, including functions to load images from files, and to create new images.

PIL.Image.open(fp, mode=‘r’, formats=None)[source]

Opens and identifies the given image file.

This is a lazy operation; this function identifies the file, but the file remains open and the actual image data is not read from the file until you try to process the data (or call the load() method). See new(). See File Handling in Pillow.

PARAMETERS:
fp – A filename (string), pathlib.Path object or a file object. The file object must implement file.read, file.seek, and file.tell methods, and be opened in binary mode.

mode – The mode. If given, this argument must be “r”.

formats – A list or tuple of formats to attempt to load the file in. This can be used to restrict the set of formats checked. Pass None to try all supported formats. You can print the set of available formats by running python3 -m PIL or using the PIL.features.pilinfo() function.

RETURNS:
An Image object.

RAISES:
FileNotFoundError – If the file cannot be found.

PIL.UnidentifiedImageError – If the image cannot be opened and identified.

ValueError – If the mode is not “r”, or if a StringIO instance is used for fp.

TypeError – If formats is not None, a list or a tuple.

以上是关于Python Imaging Library---PIT的主要内容,如果未能解决你的问题,请参考以下文章

安装Python Imaging Library记录

Python Imaging Library---PIT

Python Imaging Library---PIT

Python Imaging Library---PIT

安装Python图型处理库Python Imaging Library(PIL)

PIL(Python Imaging Library)图像处理库教程