百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pilkit

> 编程语言
开源

为 PIL 构建的工具和处理器,并基于 PIL

199 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

为 PIL 构建的工具和处理器,并基于 PIL

PILKit is a collection of utilities for working with PIL (the Python Imaging Library).

One of its main features is a set of processors which expose a simple interface for performing manipulations on PIL images.

Looking for more advanced processors? Check out Instakit_!

For the complete documentation on the latest stable version of PILKit, see PILKit on RTD_.

.. image:: https://github.com/matthewwithanm/pilkit/workflows/Python%20CI/badge.svg :target: https://github.com/matthewwithanm/pilkit/actions?query=workflow%3A%22Python+CI%22

.. _PILKit on RTD: http://pilkit.readthedocs.org .. _Instakit: https://github.com/fish2000/instakit

Installation

  1. Install PIL_ or Pillow_.
  2. Run pip install pilkit (or clone the source and put the pilkit module on your path)

.. note:: If you've never seen Pillow before, it considers itself a more-frequently updated "friendly" fork of PIL that's compatible with setuptools. As such, it shares the same namespace as PIL does and is a drop-in replacement.

.. _PIL: http://pypi.python.org/pypi/PIL .. _Pillow: http://pypi.python.org/pypi/Pillow

Usage Overview

Processors

The "pilkit.processors" module contains several classes for processing PIL images, which provide an easy to understand API:

.. code-block:: python

from pilkit.processors import ResizeToFit

img = Image.open('/path/to/my/image.png')
processor = ResizeToFit(100, 100)
new_img = processor.process(img)

A few of the included processors are:

  • ResizeToFit
  • ResizeToFill
  • SmartResize
  • Adjust
  • TrimBorderColor
  • Transpose

There's also a ProcessorPipeline class for executing processors sequentially:

.. code-block:: python

from pilkit.processors import ProcessorPipeline, ResizeToFit, Adjust

img = Image.open('/path/to/my/image.png')
processor = ProcessorPipeline([Adjust(color=0), ResizeToFit(100, 100)])
new_image = processor.process(img)

Utilities

In addition to the processors, PILKit contains a few utilities to ease the pain of working with PIL. Some examples:

prepare_image Prepares the image for saving to the provided format by doing some common-sense conversions, including preserving transparency and quantizing. save_image Wraps PIL's Image.save() method in order to gracefully handle PIL's "Suspension not allowed here" errors, and (optionally) prepares the image using prepare_image

Utilities are also included for converting between formats, extensions, and mimetypes.

Community

Please use the GitHub issue tracker _ to report bugs. A mailing list _ also exists to discuss the project and ask questions, as well as the official #imagekit _ channel on Freenode. (Both of these are shared with the django-imagekit_ project—from which PILKit spun off.)

.. _django-imagekit: https://github.com/jdriscoll/django-imagekit

Issues· 9 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言