The greatest problem with your code is that 'gimp-image-resize' does  
NOT scale the image to a different size, it merely changes the canvas  
size of the image. If you want to scale your "captured" image, you  
should use 'gimp-image-scale' or 'gimp-image-scale-full'.

Also, there is not much point to performing a rectangle select on the  
target image. I suspect that your intent in doing so is to have the  
upper-left corner of the pasted buffer align with the upper-left  
corner of the selection; however, this is not how 'gimp-edit-paste'  

Instead, you should change the offsets of the floating selection after  

   (set! sel-float (car (gimp-edit-paste drawable FALSE)))
   (gimp-layer-set-offsets sel-float 20 20)
   (gimp-floating-sel-anchor sel-float)

As long as your copy buffer is the proper size, there is no need to  
perform a rectangle select of the targeted region. However, if you'd  
rather be absolutely certain that nothing outside the targeted region  
gets modified, you should select the region and use the Paste Into  
option of 'gimp-edit-paste' (it is still necessary to change the  

   (gimp-rect-select image 20 20 563 368 REPLACE 0 0)
   (set! sel-float (car (gimp-edit-paste drawable TRUE)))
   (gimp-layer-set-offsets sel-float 20 20)
   (gimp-floating-sel-anchor sel-float)

Quoting Jason Yau <>:

> All,
> I'm new to script-fu, and brushing up on my rusty Scheme, which I
> haven't used in about 15 years!
> I'm trying to write a script that will help me automate creating a
> photobooth-like experience. I have a template with a space for 4
> images, and some captured images that I want to scale down and
> copy/paste into the template.
> Here is my code, which oddly, which alternates between working
> properly, throwing an error about a bad drawable ID, and saving the
> template without the transformed, pasted image.


Gimp-user mailing list

Reply via email to