copy snapshot of card rectangle into image container

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

copy snapshot of card rectangle into image container

Post by jalz » Fri Jul 25, 2014 8:36 pm

Hey all,

I would like to copy a specific rectangle on one of my cards and paste it into a image object Looking through the dictionary, I have found the following code which pretty much copies the card and the size I want, but it doesn't place it where I want, any chance someone can point me in the right direction please.

import snapshot from rectangle 15,50,600,600 of card "Print 1" of stack "Print"

Thanks
Jalz

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: copy snapshot of card rectangle into image container

Post by Klaus » Fri Jul 25, 2014 8:41 pm

Hi Jalz,

almost:
...
EXport snapshot from rectangle 15,50,600,600 of card "Print 1" of stack "Print" TO img "your image here..."
...
:D


Best

Klaus

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: copy snapshot of card rectangle into image container

Post by jalz » Fri Jul 25, 2014 8:42 pm

Ahhh Thanks :)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: copy snapshot of card rectangle into image container

Post by FourthWorld » Fri Jul 25, 2014 8:43 pm

Import snapshot is pretty much limited to creating an image object, but export snapshot is much more flexible, allowing among other things the ability to put the image contents into a variable. Once there, you can simply put the contents of that variable into any existing image object:

Code: Select all

 export snapshot from rect 20,20,500,500 to tVar as png
put tVar into img 1
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply