覆盖图像,上、下、左或右,带标题。
imagetitle的Python项目详细描述
覆盖图像标题
这是一个工具,imagetitle
,可以帮助在图像上覆盖一小段文本。在
这对于为演示中使用的图像添加一些学分特别有用。在
imagetitle -i input.png --title="This is title text." -p "bottom"
上面这张照片的图片来源于gotoİrfan Simsar[https://unsplash.com/@irfansimsar]
使用
^{pr2}$选项:
-i, --input PATH
:图像文件名。[默认值:输入.png]在-o, --output PATH
:输出文件名。[默认值:输出.png]在-p, --position [bottom|top|left|right]
:放置磁贴的位置。[默认值:底部]-t, --title TEXT
:标题的文本。在-f, --font TEXT
:字体名称或路径。在-r, --fraction FLOAT RANGE
:标题应该覆盖图像边缘的哪个部分(0到1)?[默认值:75]--version
--install-completion
:当前shell的安装完成。在--show-completion
:显示当前shell的完成情况,以复制它或自定义安装。在--help
:显示此消息并退出。在
安装
有多种方法可以安装此实用程序。在
Python
如果您熟悉在虚拟环境中安装python包,则可以使用以下工具进行安装:
pip install imagetitle
这将为您提供一个可以在终端上使用的命令行应用程序。在
皮克斯
另一种方法是使用名为Pipx的实用程序来安装应用程序。在
pipx install imagetitleorpipx install git+https://github.com/rnwolf/overlay_image_title/
Docker
该实用程序也打包在Docker image中。在
如果您安装了docker,那么您可以将应用程序和python放在一个映像中。在
docker pull rnwolf/overlayimagetitle
显示应用程序帮助
docker run -t -i --rm -v ${PWD}:/app overlayimagetitle:latest
显示版本
docker run -t -i --rm -v ${PWD}:/app overlayimagetitle:latest --version
给定一个名为输入.png在当前工作方向,然后用这个产品输出.png在里面
docker run -t -i --rm -v ${PWD}:/app overlayimagetitle:latest -i /app/input.png -f /fnt/Ubuntu-C.ttf
打开docker容器内部的bash shell
docker run -t -i --rm --entrypoint /bin/bash -v ${PWD}:/app overlayimagetitle:latest
Docker Image的设置别名
使用docker运行命令设置时,imagetitle的命令别名 在您的powershell配置文件中添加以下内容
function imagetitle {
docker run -it --rm v ${pwd}:/app overlayimagetitle:latest $args
}
或者,如果您使用bash终端,则通过添加以下内容更新.bashrc profilr:
alias imagetitle='docker run -it --rm -v \`pwd\`:/app overlayimagetitle:latest'
- 项目
标签: