Imagecast类似于ImageMagick,但专为Python程序员设计。可选通过HTTP API提供其功能。
项目描述
关于
Imagecast类似于ImageMagick,但专为Python程序员设计。可选通过HTTP API提供其功能。
可能还有其他问题。
安装
先决条件
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还可以捕获网页的截图,或者捕获网页中的特定元素。它使用Playwright和Firefox将完整页面或特定的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 查看散列)
关闭
imagecast-0.7.0.tar.gz的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | ec48b5e01166338cdb838db9f0cbf8408117e4521209f72b82beafb6ba618a6f |
|
MD5 | b35aa405d42003ceb262df4a0832725b |
|
BLAKE2b-256 | 5b3c8093c5de29b27807ff8051cffd33b11fed5f5b88f286ba8be2c6d656320d |
关闭
imagecast-0.7.0-py3-none-any.whl的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 5a8ee60a6c868262fc56866fdf4f0ef8744e9c222866e8a592cb24b38775984d |
|
MD5 | e3059f43492ae7367e47aa418dea31a3 |
|
BLAKE2b-256 | c81f8e43235439dd836019f01c742e2bcf9378dc45e373b6c77684466704643a |