【发布时间】:2014-04-15 20:43:36
【问题描述】:
我正在尝试编写一个脚本,在 ubuntu 13.10 上使用 gimp 2.8 重新调整大小、移动和混合两个图像。
我在这里上传了 2 张所需的图片和结果: http://imgur.com/a/bjgIA
我设法让一切都跑起来,但有一点失败了。混合命令。我将问题简化为 pdb.gimp_edit_blend 命令,它不是将图层蒙版与透明背景混合,而是创建不透明的渐变。
image = gimp.image_list()[0] #image is 237x300 png like above
pdb.gimp_image_resize(image, 300, 300, -100, 0)
fg_layer = pdb.gimp_image_get_active_layer(image)
mask = pdb.gimp_layer_create_mask(fg_layer,ADD_WHITE_MASK)
pdb.gimp_image_add_layer_mask(image, fg_layer, mask)
# from here it goes wrong, if I skip this step than I can get the correct result
# using the gimp blent tool from the gui using the same settings as here
pdb.gimp_edit_blend(fg_layer, FG_BG_RGB_MODE, NORMAL_MODE, GRADIENT_LINEAR, 100, 0, 0, True, False, 0, 0, True, 0, 150, 150, 150)
完整代码在这里:http://pastie.org/9079343
知道我做错了什么吗? 非常感谢
【问题讨论】:
-
您收到的不良结果是什么?
-
@CodeCamper i.imgur.com/wLzcq0a.jpg 也在上面提到的结果相册中