Export snapshot to an image?

Keith Clarke keith.clarke at clarkeandclarke.co.uk
Mon Apr 18 09:57:22 EDT 2011


Hi Graham,
You might want to try something along the lines of

import snapshot from rectangle 0,0,1024,768 of card "target"
set the name of the last image to "The image name I want"

...which worked for me - and I think it bypasses the clipboard.
Best,
Keith..

On 18 Apr 2011, at 14:46, Klaus on-rev wrote:

> Hi Graham,
> 
>> I've been extracting bits of images using 'export snapshot', and this goes fine if the export is to a file. However, I have now tried to do an export to an image and nothing seems to happen. The command has the form
>> 
>> export snapshot from rect a,b,c,d of img "LargeBitmap" of cd "BitMapStore" of stack "FullSizeBitMap" to img "TestImage" of cd 1 of stack "Test"
>> 
>> All the objects and quantities in this script fragment have been tested as being of correct value and existence, and indeed the same 'from' values can export a valid file.
>> 
>> The docs seem to say that what I'm trying to do is legit - what am I doing wrong?
> 
> this is what LiveCode does not like:
> ... from rect a,b,c,d...
> 
> Try this:
> ...
> put a & "," & b & "," & c & "," & d into tRect
> export snapshot from rect tRect of img "LargeBitmap" of cd "BitMapStore" of stack "FullSizeBitMap" to img "TestImage" of cd 1 of stack "Test"
> ...
> 
>> TIA
>> 
>> Graham
>> 
>> PS If anyone knows any other way of non-destructively copying a part of an image without munging the clipboard, I'd be more than happy to use it.
> 
> That's what I would like to know, too, as long as fiddling with "imagedata" is not involved ;-)
> 
> 
> Best
> 
> Klaus





More information about the use-livecode mailing list