Gimp的python-plugins,gimppython-plugins,在用户选择图片上需要制成
Gimp的python-plugins,gimppython-plugins,在用户选择图片上需要制成
在用户选择图片上需要制成mask图范围之后,使用本插件
#!/usr/bin/env python# _*_ coding: utf-8 _*_import osfrom gimpfu import *from gimpenums import *#fList = list()def gprint(msg): pdb.gimp_message(msg) return#def writeXML(fileList,filePath):'''#添加xml元素,element是layer_name,Cname是componentNamedef addElement(element,Cname): fList.append([element,Cname])'''#遍历layer,输出他们的component_name'''def loopLayer(layerList): for i in layerList: for j in xrange(len(i)): gprint(i[j])'''#填充颜色 def fill_the_mask(image,drawable,layer_name,component_name): #获得当前image img = gimp.image_list()[0] #获得原始图层 original_layer = img.layers[0] #新建一个图层 active_layer = img.new_layer() #将这个图层的不透明度改成100.0 active_layer.opacity = 100.0 #将这个图层填充为背景色 active_layer.fill(1) #名字改成layer_name传进来的 active_layer.name = layer_name + '$' + component_name #然后将这个图层的选择部分变成前景色 pdb.gimp_edit_bucket_fill_full(active_layer,0,0,100,255,True,True,0,0,0) #添加元素列表 #addElement(layer_name,component_name) #将这个active_layer的眼睛取消 active_layer.visible = False #将活动图层转到original_layer上 pdb.gimp_image_set_active_layer(img, original_layer) #loopLayer(fList)#注册函数: register( "fill-mask", "fill-mask", "fill the mask", "MingL_Wang", "Glue Team", "2012", "<Image>/MyScripts/fill-mask", "*", [ (PF_STRING, "layer_name", "LayerName ", " "), (PF_STRING, "component_name", "componentName ", " ") ], [], fill_the_mask )main()#该片段来自于http://byrx.net
评论关闭