Imagecast is like ImageMagick but for Pythonistas. Optionally provides its features via HTTP API.
Project description
Imagecast
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for imagecast-0.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 588103dd03b1dcf1125c006a034fbd1b573530375430e534fba68101aad37aa2 |
|
MD5 | e5e28797c9126d9db71078f7e29bf960 |
|
BLAKE2b-256 | 5032f4c17dee5d663719fd01ec93bf43015404ddc649927ed84bfcb1f30151fe |