Pasting part of an image to a specific loc by scripting?

Wilhelm Sanke sanke at
Sun Mar 26 11:47:51 EST 2006

On Fr,  24.03.2006, I had written:

> Is it possible to paste a copied portion of an image to another place 
> in that same image by scripting, e.g. the topleft quarter to the 
> topright quarter?
> The paste command always places the copied part of an image at the 
> center of the image as in the following script, so what kind of 
> parameters should be added?:
> (snip)
> As usual, the solution is probably quite simple, but I cannot find any 
> relevant information how to to this in the docs.
> As a workaround, one could use a succession of snapshots and the 
> deleting of the interim images, but I think there must be an easier 
> way using paste, drag, move etc.
> Any suggestions are welcome!

The lack of responses to this question probably implies that the answer 
is definitely "no" and at the same time points to the level of urgency 
of my information request, which is indeed something very much like a 

It is possible to paste part of an image - using "choose select tool", 
"drag from x,y to x2,y,2", "copy", and "paste" with an appropriate 
script - as a *new image* to the center of the screen, which then can be 
dragged like any other object to a specific loc. However to "combine" 
(not a keyword) the layers of the two images is then only possible with 
a snapshot and deleting the last two images underneath.

Pasting a selection into the image itself - this was my question - 
always results in the copied selection being put at the loc of the image 
- and what is important here - without any possibility to move the 
pasted selection anywhere else as it has become an *integrated* part of 
the image.
You could of course again select the pasted part - after having done 
your math - with the select tool and drag it elsewhere by script, but 
that would leave the area of the image from where the selection was 
drawn as "blank".

The engine apparently knows how to place selections of an image to a 
specific location; each time it has to compute the point where to paste: 
either the screenloc or the center of the image into which the selection 
should be put.

Therefore it must be relatively easy to add a new feature for pasting 
image selections using a syntax like "paste at x,y".

I will submit an enhancement request.


Wilhelm Sanke

More information about the Use-livecode mailing list