我正在尝试将Imagemagick脚本重写为Imagick。我很想将以下代码段写给Imagick。
-compose mathematics
有人可以检查是否有选项吗?我找不到类似-compose的选项 imagick :: COMPOSITE_MATHEMATICS in PHP
答案 0 :(得分:0)
在Imagemagick命令行中,如果您有两个输入图像A和B
convert A B -define compose:args="a,b,c,d" -compose mathematics result
then
that means
a*A*B + b*B + c*A +d
so
a*A*B is
convert A B -compose multiply -composite -evaluate multiply a tmp1
b*B is
convert B -evaluate multiply b tmp2
c*A is
convert A -evaluate multiply c tmp3
a*A*B + b*B + c*A +d
convert tmp1 tmp2 -compose plus -composite tmp3 -compose plus -composite -evaluate add 100*d% result
where 100*d must be evaluated ahead of time
您将需要获得Imagick等效产品。
-compose数学的所有用法并非都是可分离的,如果其中涉及的值超出了编译的“量子范围”。因此,请确保您需要使用Imagemagick的HDRI编译,例如使用Imagemagick 7的默认编译或在启用HDRI的情况下重新编译IM 6。
如果您不能使用HDRI,那么如果单独的操作不起作用,那么您将需要使用-fx来执行等效操作,这会相当慢