Skip to main content
Deno 2 is finally here 🎉️
Learn more

Python Pillow for Deno

Image processing capabilities, resize, rotate, watermarks & filters.

Install

Download and install Python https://www.python.org/downloads/. Next, install argparse and pillow

Windows:

pip install argparse pillow

Linux or Mac:

pip3 install argparse pillow

Example

import { pillow } from 'https://deno.land/x/python_pillow/mod.js'

const image = './example.jpg'

await pillow.resize(image, 400)
await pillow.rotate(image, 180)

// deno run --allow-read --allow-write --allow-net --allow-run=python3.9 --watch --unstable example.js

Resize

await pillow.resize(image, 200) // image, width px

Rotate

await pillow.rotate(image, 200) // image, deg

Thumbnail

await pillow.thumbnail(image, 200) // image, width

Merge

const merge = {
    img: 'second_image.jpg',
    x: 100,
    y: 100
}

await pillow.merge(image, merge) // image, configs

Watermark

const watermark = {
    font: 'lato.ttf',
    color: '#ffffff',
    size: 200,
    x: 100,
    y: 100,
    text: 'hello world!'
}

await pillow.watermark(image, watermark) // image, configs

Horizontal flip

await pillow.horizontalFlip(image) 

Vertical flip

await pillow.verticalFlip(image) 

Blur

await pillow.blur(image) 

Contour

await pillow.contour(image) 

Detail

await pillow.detail(image) 

Edges

await pillow.edges(image) 

Edge enhance

await pillow.edge_enhance(image) 

Edge enhance x3

await pillow.edge_enhance_more(image) 

Emboss

await pillow.emboss(image) 

Sharpen

await pillow.sharpen(image) 

Smooth

await pillow.smooth(image) 

Smooth more

await pillow.smooth_more(image) 

Grayscale

await pillow.grayscale(image)