Python imaging notes

This was the home of PythonWare and the Python Imaging Library. PIL itself stopped in 2011 and lives on as Pillow. What sits here now is written for the code people are running today, with a set of small tools that work in the browser.

Tools

PIL to Pillow converter

Paste code written against old PIL and see what has to change for Pillow 10 and later. Covers the constants that moved into enums, the renamed methods and the imports.

Open the converter

Pillow playground

Resize, rotate, blur and adjust an image with sliders, watch the result, and copy the Pillow code that produces it.

Open the playground

Resampling filters compared

Nearest, bilinear, bicubic and Lanczos on your own image, side by side, with timings. The filters are implemented properly, not faked with browser smoothing.

Compare the filters

Image modes explained

See what RGB, L, 1 and P actually do to a picture, including Floyd and Steinberg dithering, with the memory cost of each.

Open the mode viewer

Image converter and compressor

Convert between PNG, JPEG and WEBP, resize, and see how many bytes you saved. Several files at once.

Open the converter

Exif viewer and remover

See the camera, date and GPS data hidden inside a photo, then save a copy with all of it stripped out.

Open the viewer

Colour palette from an image

Pull the main colours out of a picture by median cut, the same algorithm Pillow quantises with, and copy them as hex.

Extract a palette

Image to ASCII art

Turn a picture into text art, adjust the width and characters, and take the Python that does the same.

Make some art

Kernel designer

Type weights into a grid, watch the picture change, copy the ImageFilter.Kernel code. Matches Pillow pixel for pixel.

Open the designer

Favicon generator

One image into a proper favicon.ico holding 16, 32 and 48 pixel versions, plus PNGs for Apple and Android.

Make a favicon

Image diff

Two pictures, the changed pixels in red, with a count and a percentage. For screenshot tests and spotting edits.

Compare two images

Images to PDF

Several pictures into one PDF, in order, on A4 or sized to each image.

Make a PDF

When something goes wrong

One page per error, with the cause and the fix: ANTIALIAS removed, textsize removed, cannot write mode RGBA as JPEG, image file is truncated, No module named PIL, no $DISPLAY, Tkinter image not showing, and the rest.

Reference