跳转到主要内容

Imagecast类似于ImageMagick,但专为Python程序员设计。可选通过HTTP API提供其功能。

项目描述


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

关于

Imagecast类似于ImageMagick,但专为Python程序员设计。可选通过HTTP API提供其功能。

目前,这基于Pillow。然而,将来可能基于Wand

可能还有其他问题。

安装

先决条件

pip install imagecast

带有服务API

pip install imagecast[service]

功能

  • 色彩空间转换:单色,灰度

  • 带有负的右/下偏移量的裁剪

  • 保持宽高比的同时调整大小

  • 输出格式:来自Pillow的任何图像格式或原始字节

  • HTTP API

概述

# 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

示例

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

HTML捕获

Imagecast还可以捕获网页的截图,或者捕获网页中的特定元素。它使用PlaywrightFirefox将完整页面或特定的DOM元素转换为位图。

安装Imagecast后,运行

playwright install firefox

然后,像这样调用Imagecast:

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

为了选择捕获的特定元素,使用--element选项来指定要应用的DOM选择器

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

HTTP API

以守护进程方式启动Imagecast服务

imagecast service

示例

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

其他项目

项目详情


下载文件

下载适用于您平台的应用程序。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

imagecast-0.7.0.tar.gz (22.5 kB 查看散列)

上传时间

构建分布

imagecast-0.7.0-py3-none-any.whl (20.3 kB 查看散列)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页