Python image processing libraries

Updated Nov 2026

Python image processing libraries open image files, change their pixels, and save the results. These libraries resize uploads, prepare training data for vision models, and convert images between formats.

Popularity

Pillow has the most installs, while torchvision has the most GitHub stars.

LibraryMonthly downloadsStarsLast releaseLicense
Pillow
436.5M
14.0KOct 2026MIT-CMU
imageio
37.1M
1.7KOct 2026BSD-2-Clause
opencv-python
29.9M
5.4KJul 2026MIT
torchvision
15.5M
18.0KOct 2026BSD-3-Clause
kornia
2.2M
12.4KOct 2026Apache-2.0
imagecodecs
1.3M
194Oct 2026BSD-3-Clause
wand
1.1M
1.5KJun 2026MIT
pyvips
901.5K
816Aug 2026MIT
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Features compared

LibraryReads video framesWorks on NumPy arraysDraws shapes and textRuns on a GPUOutput formats
PillowVia pluginBuilt-inUndocumentedUnsupportedPDF, PNG, JPEG
imageioUndocumentedBuilt-inUndocumentedUndocumentedPNG, JPEG, TIFF
opencv-pythonBuilt-inBuilt-inBuilt-inUnsupportedPNG, JPEG, WebP
torchvisionBuilt-inBuilt-inBuilt-inBuilt-inPNG, JPEG, WebP
korniaBuilt-inVia pluginBuilt-inUndocumentedPNG, JPEG, TIFF
imagecodecsUndocumentedBuilt-inUndocumentedUnsupportedPNG, JPEG, WebP
wandUndocumentedBuilt-inBuilt-inUndocumentedPNG, JPEG
pyvipsUndocumentedBuilt-inBuilt-inUnsupportedPNG, JPEG
Built-inVia pluginNot supportedNot documented

Libraries and code examples

Pillow is the maintained fork of PIL, the Python Imaging Library. Image.open reads a file and detects its format from the contents, and save writes it back out, choosing the format from the file extension. Between the two, modules such as ImageDraw, ImageFilter, and ImageOps draw, filter, resize, crop, and convert colors. Reading covers many more formats than writing, which sticks to the common interchange formats.

Downloads / mo
436.5M
Stars
14.0K
Last release
13.0.0, Oct 2026
License
MIT-CMU

Strengths

  • Everyday image tasks. Thumbnails, resizing, format conversion, drawing, and metadata in one package.
  • Text, EXIF, and color profiles. ImageDraw renders text, and Pillow reads EXIF metadata and converts ICC color profiles.
  • Prebuilt wheels. pip installs prebuilt wheels, with no separate image program to install.

Limitations

  • Slow on large images. A large blur took 15 times as long as OpenCV's.
  • No video or camera input. Use OpenCV or imageio for video.

Quickstart

From the docs
$ pip install pillow
from PIL import Image

with Image.open("hopper.jpg") as im:
    print(im.getbands())  # Returns ('R', 'G', 'B')

Pillow examples

From open-source projects on GitHub

Resizes an uploaded image to a fixed size, applying EXIF rotation and saving it as WebP with Pillow.

Makes a thumbnail with Pillow, rotating it to match the EXIF orientation and cropping it to fit.

imageio reads and writes images and video as NumPy arrays through a handful of functions: imread, imwrite, and imiter, which steps through the frames of an animation or video. Its only core dependencies are NumPy and Pillow. Video needs imageio-ffmpeg or pyav, and TIFF files need tifffile. Files, URLs, and bytes all work as input. Unlike Pillow, imageio returns plain arrays rather than image objects.

Downloads / mo
37.1M
Stars
1.7K
Last release
2.38.1, Oct 2026
License
BSD-2-Clause

Strengths

  • Hundreds of formats. Reads and writes about 250 image and 100 video formats.
  • Returns NumPy arrays. Images come back as arrays, ready for NumPy code.

Limitations

  • Some formats need plugins. Opening one without its backend installed fails.
  • Results vary by backend. A different backend can change the array shape or metadata.

Quickstart

From the README
$ pip install imageio
import imageio.v3 as iio
im = iio.imread('imageio:chelsea.png')  # read a standard image
im.shape  # im is a NumPy array of shape (300, 451, 3)
iio.imwrite('chelsea.jpg', im)  # convert to jpg

imageio examples

From open-source projects on GitHub

Blurs faces in a photo, reading it and its EXIF metadata with imageio and saving the result.

Blurs faces in a video frame by frame, reading and writing it through imageio's FFmpeg plugin.

opencv-python

opencv-python installs OpenCV, the computer vision library, as prebuilt wheels that run on the CPU. The project publishes four packages: the main build and a contrib build with extra modules, each with a headless variant that leaves out GUI libraries for Docker and servers. All four share one module name, so each environment takes exactly one package. CUDA and other optional modules need a manual build from source.

Downloads / mo
29.9M
Stars
5.4K
Last release
5.0.0.93, Jul 2026
License
MIT

Strengths

  • Fast filtering and resizing. Ran a large blur 15 times faster than Pillow.
  • Computer vision and video. Also handles face detection, tracking, and video files.
  • Server build available. opencv-python-headless skips GUI libraries for Docker and servers.

Limitations

  • Colors load as BGR. Convert to RGB before using images with Pillow or PyTorch.
  • One OpenCV package per environment. Installing a second one overwrites the first.
  • No GPU from pip. CUDA support means building OpenCV from source.

Quickstart

From the docs
$ pip install opencv-python
import cv2 as cv
import sys

img = cv.imread(cv.samples.findFile("starry_night.jpg"))
if img is None:
    sys.exit("Could not read the image.")

cv.imshow("Display window", img)
k = cv.waitKey(0)
if k == ord("s"):
    cv.imwrite("starry_night.png", img)

opencv-python examples

From open-source projects on GitHub

Scans a photographed document by warping it flat, sharpening it, and thresholding it to black and white with OpenCV.

Prepares a camera frame for card detection by converting it to grayscale, blurring it, and thresholding it with OpenCV.

torchvision is the computer vision package for PyTorch, with datasets, model architectures, and image transforms. Its current transforms API resizes, crops, flips, and normalizes images for training or inference, and moves bounding boxes and masks along with the image. Transforms accept PIL images or tensors, including CUDA tensors that stay on the GPU. Each torchvision release pairs with a single PyTorch version.

Downloads / mo
15.5M
Stars
18.0K
Last release
0.29.2, Oct 2026
License
BSD-3-Clause
Runs on
PyTorch

Strengths

  • Pretrained models included. Ships datasets, reference models, and pretrained weights.
  • Feeds PyTorch directly. Loaded images go straight into a PyTorch model.
  • Boxes follow the image. v2 transforms move bounding boxes and masks along with the image.

Limitations

  • OpenCV images need converting. Convert OpenCV's BGR arrays to RGB first.
  • One random setting per call. Per-image random settings in a batch need a loop.

Quickstart

From the docs
$ pip install torchvision
import torch
from torchvision.transforms import v2

H, W = 32, 32
img = torch.randint(0, 256, size=(3, H, W), dtype=torch.uint8)

transforms = v2.Compose([
    v2.RandomResizedCrop(size=(224, 224), antialias=True),
    v2.RandomHorizontalFlip(p=0.5),
    v2.ToDtype(torch.float32, scale=True),
    v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
img = transforms(img)

torchvision examples

From open-source projects on GitHub

Resizes a batch of image tensors to a given width and height with torchvision's resize.

Flips a batch of image tensors horizontally or vertically with torchvision.

Kornia is a computer vision library built on PyTorch. Its operations are differentiable, so gradients flow through them during training. Its more than a thousand operators cover filters, color conversion, geometric warps, feature matching, and camera models, and most have no equivalent in torchvision. Functions such as rotate take one parameter per image in a batch, and every operator accepts CPU, CUDA, and Apple MPS tensors.

Downloads / mo
2.2M
Stars
12.4K
Last release
0.9.0, Oct 2026
License
Apache-2.0
Runs on
PyTorch

Strengths

  • Works on PyTorch tensors. No conversion between steps.
  • Trainable image operations. Filters and transforms keep gradients, so they run inside training.
  • Batched per-image settings. rotate takes one angle per image in a batch, with no loop.

Limitations

  • Assumes PyTorch experience. Expects working knowledge of PyTorch and computer vision.
  • Slower than OpenCV on single CPU images. OpenCV wins when processing one uint8 image at a time on the CPU.

Quickstart

From the docs
$ pip install kornia
import numpy as np
import torch
import kornia

np_img = (np.random.rand(48, 64, 3) * 255).astype(np.uint8)  # (H, W, C) uint8
t = kornia.image.image_to_tensor(np_img)[None].float() / 255.0  # (1, 3, 48, 64) in [0, 1]

kornia examples

From open-source projects on GitHub

Applies a morphology operation such as erosion or dilation to an image batch with Kornia.

imagecodecs encodes and decodes image and compression formats in memory, for scientific image packages such as tifffile and zarr. Each codec has a pair of functions named after it, following the codec_encode and codec_decode pattern, that convert between bytes and NumPy arrays, while imread and imwrite read and write files directly. Coverage includes AVIF, HEIF, EXR, WebP, and TIFF, plus byte compressors such as Zstandard and Brotli.

Downloads / mo
1.3M
Stars
194
Last release
2026.10.10, Oct 2026
License
BSD-3-Clause

Strengths

  • Newer and scientific formats. Encodes and decodes AVIF, HEIF, EXR, and more as NumPy arrays.
  • Only needs NumPy. No other runtime dependencies.
  • Decodes in parallel. Threads can encode and decode at the same time.

Limitations

  • In-memory data only. Large files and metadata need tifffile or zarr on top.
  • API still changes. Function signatures can change between releases.
  • Little-endian only. The package runs only on little-endian platforms.

Quickstart

From the README
$ pip install imagecodecs
import numpy
array = numpy.random.randint(100, 200, (256, 256, 3), numpy.uint8)

from imagecodecs import imwrite, imread
imwrite('_test.jp2', array)
image = imread('_test.jp2')

imagecodecs examples

From open-source projects on GitHub

Encodes an image array as a JPEG XL file with imagecodecs, setting bit depth, color tags, and compression effort.

Compresses a grayscale or color image chunk to JPEG XL with imagecodecs.

Wand is a Python binding for ImageMagick that calls its MagickWand library through ctypes, Python's module for calling C libraries, which also lets it run on PyPy, an alternative Python interpreter. Image(filename=...) opens a file inside a with block, and methods such as resize and save work on it. ImageMagick itself is installed separately, such as the libmagickwand-dev package from APT on Debian and Ubuntu.

Downloads / mo
1.1M
Stars
1.5K
Last release
0.7.2, Jun 2026
License
MIT

Strengths

  • ImageMagick from Python. Uses the same resize and crop syntax as the ImageMagick command line.
  • Format conversion with quality control. Converts formats and sets output quality.
  • Converts formats with quality control. Converts between formats and sets output quality for web and slide exports.

Limitations

  • Needs ImageMagick installed. Imports fail without ImageMagick on the system.
  • Needs hardening for uploads. Untrusted files need a locked-down ImageMagick policy.
  • Slow on large photos. Made a thumbnail about ten times slower than Pillow or OpenCV.

Quickstart

From the docs
$ pip install wand
from wand.image import Image
from wand.display import display

with Image(filename='mona-lisa.png') as img:
    print(img.size)
    for r in 1, 2, 3:
        with img.clone() as i:
            i.resize(int(i.width * r * 0.25), int(i.height * r * 0.25))
            i.rotate(90 * r)
            i.save(filename='mona-lisa-{0}.png'.format(r))
            display(i)

wand examples

From open-source projects on GitHub

Adds motion blur to an image with ImageMagick through Wand, then decodes the result into an array.

Draws a motion-blurred snow layer over an image, blurring the layer with Wand.

pyvips is the Python binding for libvips. A program builds a pipeline of operations on a source image, and the pipeline runs only when the result is written. libvips then streams the image through it a section at a time, in parallel. Because libvips never loads an entire image into memory, memory use stays low on very large files. pip install "pyvips[binary]" installs a self-contained build with the most common libraries.

Downloads / mo
901.5K
Stars
816
Last release
3.2.0, Aug 2026
License
MIT

Strengths

  • Fast with low memory. About 3 times faster than ImageMagick, with 5 times less memory.
  • Handles huge images. Processes images in sections instead of loading them whole.

Limitations

  • Bundled build skips PDFs. Reading PDFs needs a system-installed libvips.
  • Slower without a compiler. Without a C compiler at install, it runs about 20% slower.

Quickstart

From the README
$ pip install pyvips
import pyvips

image = pyvips.Image.new_from_file('some-image.jpg', access='sequential')
image *= [1, 2, 1]
mask = pyvips.Image.new_from_array([
    [-1, -1, -1],
    [-1, 16, -1],
    [-1, -1, -1],
], scale=8)
image = image.conv(mask, precision='integer')
image.write_to_file('x.jpg')

pyvips examples

From open-source projects on GitHub

Crops and resizes an uploaded avatar to a square PNG with pyvips.

Shrinks an uploaded logo to fit within maximum dimensions with pyvips, keeping its aspect ratio.

FAQ

Pillow is the usual default for opening, resizing, drawing on, and saving images, with 436.5M downloads a month. OpenCV is faster at heavy filtering and adds computer vision and video. pyvips suits very large images, and torchvision suits PyTorch training pipelines.

Use Pillow for opening, converting, resizing, drawing on, and saving images, including text, EXIF data, and color profiles. Use OpenCV for computer vision, video, cameras, and heavy filtering. Both work with NumPy arrays, so many projects use the two together.

Yes, on full-resolution work: a large blur ran 15 times faster in OpenCV than in Pillow. For thumbnails the two run at about the same speed, once Pillow uses draft() to decode the JPEG at a smaller size.

pyvips processes images in sections instead of loading them whole, so it stays fast and uses little memory on huge files. It also suits batch thumbnailing. Its bundled build can't read PDFs, which needs a system-installed libvips.

OpenCV and torchvision read video frames directly, and OpenCV also reads from cameras. imageio reads and writes video through its FFmpeg plugin. Pillow has no video or camera input.

PIL is the original Python Imaging Library, which stopped getting releases long ago. Pillow is the maintained fork of PIL, so code still imports it under the name PIL. Install it with pip install pillow, and never install PIL in the same environment.

OpenCV is a computer vision library, and opencv-python installs it from pip as prebuilt wheels. It loads images as NumPy arrays and covers filtering, geometric transforms, feature detection, face detection, and video.

For coding agents

Found your image processing library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official