使用 imagemagick cli 显示命令结果

Display command result with imagemagick cli

所以在我的工作流程中,我经常做这样的事情:

convert image.png -level 10x90% tmp.png # try a command on a temporary file
display tmp.png # display the image to see if it looks good
rm tmp.png # delete the temporary file
mogrify -level 10x90% image.png # finaly apply the command to the image.

我想要的是一种无需创建 tmp 文件即可直接查看命令结果的方法。 像 :

convert image.png -level 10x90% | display # this does not exist

display -level 10x90% test.png # this neither

一种在执行之前快速显示 imagemagick 命令结果的方法。

是否存在

你可以这样做:

magick -size 1024x768 xc:red miff:- | display miff:-

您可能总是可以将其减少到:

magick -size 1024x768 xc:red miff: | display

MIFF 保证支持所有数据类型和任意数量的通道,因此它是一个很好的通用选择。


所以,一般来说:

magick IMAGE ...process... miff: | display

请注意,您可以根据需要使用不同的查看器,例如feh:

magick IMAGE ...process... PNG:- | feh -

在基于 Unix 的 Imagemagick 上,您可以使用 show: 命令查看图像而无需将其保存到磁盘。

magick -size 100x100 xc:red show: