Skip to main content

ci-tests Test suite code coverage license pypi-downloads python-versions status pypi-version

About

Imagecast is like ImageMagick but for Pythonistas. Optionally provides its features via HTTP API.

Currently, this is based on Pillow. However, it might be based on Wand in the future.

There might still be dragons.

Install

Prerequisites

pip install imagecast

With service API:

pip install imagecast[service]

Features

  • Colorspace conversion: monochrome, grayscale

  • Cropping with negative right/bottom offsets

  • Resizing while keeping aspect ratio

  • Output format: Any image formats from Pillow or raw bytes

  • HTTP API

Synopsis

# Display on screen
imagecast --uri="$IMGURL" --display

# Colorspace reduction to bi-level with threshold, output as bytes
imagecast --uri="$IMGURL" --monochrome=200 --format=bytes

# Colorspace reduction, cropping, resizing and format conversion
imagecast --uri="$IMGURL" --grayscale --crop=40,50,-50,-40 --width=200 --save=test.png

Example:

imagecast --uri="https://unsplash.com/photos/WvdKljW55rM/download?force=true" --monochrome=80 --crop=850,1925,-950,-900 --width=640 --display

HTML Capturing

Imagecast can also capture screenshots of webpages, or elements thereof. It uses Playwright and Firefox to convert full pages or specific DOM elements to bitmaps.

After installing Imagecast, run:

playwright install firefox

Then, invoke Imagecast like:

imagecast --uri="${URL}" --display

In order to select specific elements for capturing, use the --element option to express a DOM selector to apply:

imagecast --uri="${URL}" --element="#panel-1" --display

HTTP API

Start the Imagecast service as daemon:

imagecast service

Example:

http "localhost:9999/?uri=https%3A%2F%2Funsplash.com%2Fphotos%2FWvdKljW55rM%2Fdownload%3Fforce%3Dtrue&monochrome=80&crop=850,1925,-950,-900&width=640"

Other projects

Release files for imagecast 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imagecast 0.7.0
File Size Uploaded
imagecast-0.7.0.tar.gz 22.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for imagecast 0.7.0
File Interpreter ABI Platform
imagecast-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.8 kB

Release files / imagecast-0.7.0.tar.gz

Download URL imagecast-0.7.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ec48b5e01166338cdb838db9f0cbf8408117e4521209f72b82beafb6ba618a6f
BLAKE2b-256 checksum
How to use checksums
5b3c8093c5de29b27807ff8051cffd33b11fed5f5b88f286ba8be2c6d656320d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / imagecast-0.7.0-py3-none-any.whl

Download URL imagecast-0.7.0-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a8ee60a6c868262fc56866fdf4f0ef8744e9c222866e8a592cb24b38775984d
BLAKE2b-256 checksum
How to use checksums
c81f8e43235439dd836019f01c742e2bcf9378dc45e373b6c77684466704643a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page