Thanks, Pat.
Only added the possibility to have a different picture in picture.
(I like to keep the filter really simple).
Now the filter:
- checks whether there is a layer below the input Drawable:
-- if so the input drawable is scaled down, the layer below is blurred
-- if not the input drawable is copied and scaled down, then the original drawable is blurred
(pls note: other layers are ignored)
#!/usr/bin/env python
from gimpfu import *
def picture_in_picture (inImage, inDrawable, smallsize) :
# check whether there is a layer below inDrawable:
# - if so the inDrawable is scaled down, the layer below is blurred
# - if not the inDrawable is copied and scaled down, then the original inDrawable is blurred
# pls note: other layers are ignored
swidth = inImage.width*smallsize/100
sheight = inImage.height*smallsize/100
Layers=[]
(NL, Layers) = pdb.gimp_image_get_layers (inImage)
if len(inImage.layers)==1:
Small = inDrawable.copy()
inImage.add_layer (Small, 0)
pdb.gimp_layer_add_alpha (Small)
pdb.gimp_layer_scale (Small, swidth, sheight, True)
pdb.plug_in_gauss_iir (inImage, inDrawable, 7, True, True)
else:
Layers = inImage.layers
pdb.gimp_layer_add_alpha (Layers[0])
pdb.gimp_layer_scale (Layers[0], swidth, sheight, True)
pdb.plug_in_gauss_iir (inImage, Layers[1], 7, True, True)
return ()
register(
"picture_in_picture", "picture_in_picture", "picture_in_picture",
"anydody", "anybody", "2018",
"picture_in_picture",
"RGB*",
[
(PF_IMAGE, "image", "Input image", None),
(PF_DRAWABLE, "drawable", "Input drawable", None),
(PF_ADJUSTMENT, "smalls", "Small size (%)", 25, (10, 50, 1)),
],
[],
picture_in_picture,
menu="<Image>/Test"
)
main()
Example:
Attachment:
2pictures.jpg [ 109 KiB | Viewed 2424 times ]
(note: the foreground has been moved manually, to be more "significant")
if you want to download the zipped file, here it is:
Attachment:
Picture_In_Picture.7z [753 Bytes]
Downloaded 99 times