I'm trying to write a plugin for realistically blending tattoos to facial images, but I am unable to get any effect when using pdb.plug_in_displace in version 2.10 of GIMP. Note, that the displacement works if I manually go to Filters -> Map -> Displace and uses the same tattoo image and displacement map.
A sample of my code is given below:
img = gimp.Image(width, height)
pdb.gimp_display_new(img)
# load face and tattoo images
face_layer = open_images_as_layer(img, path_to_facial_image)
tattoo_layer= open_images_as_layer(img, path_to_tattoo_image)
# rescale tattoo layer
pdb.gimp_layer_scale(tattoo_layer, new_width, new_height, False)
# set offset of tattoo_layer
pdb.gimp_layer_set_offsets(tattoo_layer, x_offset, y_offset)
# set the tattoo_layer we want to displace to be the same size as the image
pdb.gimp_layer_resize_to_image_size(tattoo_layer)
# load the displacement map
disp_image = pdb.gimp_file_load(disp_file, disp_file)
disp_drawable = pdb.gimp_image_get_active_layer(disp_image)
# this line does not seem to do anything no matter how I set the parameters
pdb.plug_in_displace(img, tattoo_layer, 10, 10, True, True, disp_drawable, disp_drawable, 2)
Any suggestions to why the displacement (in the last line of the code above) has no effect - is really appreciated
Thanks!