La miscela di modifica GIMP nello script Python produce diversi miscela rispetto allo strumento Blend
Domanda
Sto cercando di scrivere uno script che ridistribuisce, muove e mescola due immagini in uno usando GIMP 2.8 su Ubuntu 13.10.
Ho caricato le 2 immagini necessarie e i risultati qui: http://imgur.com/a/bjgia
Sono riuscito a far funzionare tutto, ma un punto non riesce.il comando di fusione.Ho ridotto il problema al comando pdb.gimp_edit_blend che invece di fondere la maschera di livello con lo sfondo trasparente crea un gradiente opaco.
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)
.
L'intero codice è qui: http://pastie.org/9079343
Qualche idea di cosa sto facendo male? Grazie mille
Soluzione
Il tuo errore è praticamente nel tuo codice - stai chiamando la funzione di fusione che passa FG_Layer come primo parametro, invece della maschera:
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)
^^^^^^^^
.
Invece, fai la stessa chiamata che passa la maschera come parametro disegnato (lo hai già nella variabile "Maschera"):
pdb.gimp_edit_blend(mask, FG_BG_RGB_MODE, NORMAL_MODE, GRADIENT_LINEAR, 100, 0, 0, True, False, 0, 0, True, 0, 150, 150, 150)
.