Git Product home page Git Product logo

pilkit's Introduction

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.

https://api.travis-ci.org/matthewwithanm/pilkit.png

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.

Usage Overview

Processors

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

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:

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.)

pilkit's People

Contributors

matthewwithanm avatar vstoykov avatar kravemir avatar petry avatar fladi avatar fish2000 avatar edwardbetts avatar hassanabidpk avatar kezabelle avatar nrsimha avatar dulacp avatar 3x0dv5 avatar baffolobill avatar lexifdev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.