在外壳程序脚本中使用gimp颜色转换为Alpha脚本 [英] use gimp color-to-alpha script in a shell script

查看:121
本文介绍了在外壳程序脚本中使用gimp颜色转换为Alpha脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试重现颜色到Alpha功能的gimp产品,该产品根据像素中颜色的数量增加了透明度.

I am trying to reproduce the color-to-alpha function gimp offer, which adds a level of transparency depending on the amount of color in a pixel.

我想从命令行知道如何使用此功能的原因是一次单击即可将该功能应用于许多图像,而不必在gimp中一一打开每个图像.

The reason why I want to know how to use this function from a command line is to apply the function to many images in a single click without having to open each image one by one in gimp.

要从终端运行gimp脚本,请使用以下行: /Applications/GIMP.app/Contents/MacOS/gimp -i -b,然后是函数名称及其参数.

To run a gimp script from terminal, the following line is used : /Applications/GIMP.app/Contents/MacOS/gimp -i -b followed by the name of the function and its arguments.

此函数称为颜色转换为alpha",需要使用以下四个参数:

This function is called color-to-alpha and takes 4 arguments to work which are the following:

run-mode INT32 Interactive, non-interactive
image IMAGE imput image
drawable DRAWABLE input drawable
color COLOR Color to remove

所以我尝试了以下方法: /Applications/GIMP.app/Contents/MacOS/gimp -i -b '(color-to-alpha 0 "/Users/Maxime/Desktop/Images/fx_ice.png" 0 (0 0 0))' -b '(gimp-quit 0)',但出现以下错误:Error: ( : 2) eval: unbound variable: color-to-alpha

So I have tried the following: /Applications/GIMP.app/Contents/MacOS/gimp -i -b '(color-to-alpha 0 "/Users/Maxime/Desktop/Images/fx_ice.png" 0 (0 0 0))' -b '(gimp-quit 0)' but I have the following error: Error: ( : 2) eval: unbound variable: color-to-alpha

我猜问题出在我要传递的参数的语法上. 我试图找到这种情况下如何传递参数的示例,但没有发现任何东西.

I'am guessing the problem comes from the syntax of the arguments I am trying to pass. I have tried to find example of how to pass arguments like in this case but have not found anything.

如果有人知道该怎么做,那就太好了

If someone knew how to do this, it would be great,

谢谢

推荐答案

好的,我已经找到了遮阳篷.

Ok, I have found the awnser to my post.

我一直在做的事情很不对劲:p

What I was doing was pretty much wrong all the way :p

因此,这是一个批处理命令行,可从图像中去除黑色背景,例如GIMP的颜色转换为alpha功能:

So here is a batch command line that removes black baground from an image like the color-to-alpha function of GIMP :

/Applications/GIMP.app/Contents/MacOS/gimp -i -b "(let* ( ( image (car (file-png-load 1 \"/Users/Name/Desktop/img.png\" \"/Users/Name/Desktop/img.png\") ) ) (drawable (car (gimp-image-active-drawable image) ) ) ) (plug-in-colortoalpha 1 image drawable '(0 0 0) ) (gimp-file-save RUN-NONINTERACTIVE image drawable \"/Users/Name/Desktop/img2.png\" \"/Users/Name/Desktop/img2.png\") ) " -b "(gimp-quit 0)"

由于它必须是一个内联命令,但它在我的MAC上可以正常工作,所以这样的用法很不全面

It is quite incomprehensive like this because it needs to be an inline command but it works fine on my MAC

这篇关于在外壳程序脚本中使用gimp颜色转换为Alpha脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆