Export snapshot to an image?

Graham Samuel livfoss at mac.com
Mon Apr 18 11:45:43 EDT 2011


Thanks Gentlemen, both ideas are a lot better than mine. FWIW, while I was waiting for a reply (I didn't expect it to be so quick!) I thought of another method, which is to clone the image I want to take my extract from and crop the clone - then I can simply put the cropped image into the image I want. You have to fiddle with the location, as LC moves the clone 32 pixels in both dimensions. It does work, but it is clunky compared with your methods.

Thanks again

Graham

On Mon, 18 Apr 2011 15:46:44 +0200, Klaus on-rev <klaus at major.on-rev.com>wrote
> Content-Type: text/plain; charset=us-ascii
> 
> 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 ;-)
> 
and Keith Clarke <keith.clarke at clarkeandclarke.co.uk> wrote

> 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..
> 



More information about the use-livecode mailing list