exporting part of a card

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

exporting part of a card

Post by Scott Richardson » Thu Jan 15, 2009 8:45 pm

Is it possible to export a "group" from a card as a PNG (or jpg) file? I have no trouble exporting any individual image files, but I need to be able to export a group (or some other method of exporting a specific area of a card that has multiple overlapping image files as one image).

Thanks for any help.

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Post by malte » Thu Jan 15, 2009 9:07 pm

Hi,

you can use the export snapshot fromrect form.

export snapshot from rect (the rect of grp "myGroup") of grp "myGroup" to file "path/to/file" as png

should work.

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

Post by Scott Richardson » Thu Jan 15, 2009 9:44 pm

Thanks for the quick response. I have tried using the snapshot method, too, just as you have suggested, but all that shows up in the exported file is the rearmost image of the group. The other overlapping images do not appear. What happens to the rest of the group? Why only the rearmost image? Is there something else I might try?

Thanks again for any help and suggestions.

Scott

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Jan 15, 2009 10:43 pm

Hi Scott,

Perhaps it should be something like:

export snapshot from rect (the rect of grp "myGroup") of cd "Your Card" to file "path/to/file" as png

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

Post by Scott Richardson » Thu Jan 15, 2009 11:53 pm

Thanks again for the quick replies, guys. Unfortunately, the approach of referring back to the card didn't work, either. If this little app was only for Mac OSX it would be so easy just to "print" the group and save as a PDF file, but I can't use that approach for Windows since that saves as XPS.

What I am trying to accomplish is to have the user build their own image for export to be used in PowerPoint (Mac or Windows) and/or Keynote (Mac), etc. They would build the image by "turning on" or "turning off" selectable items on the card.

The group prints as it should for handouts, but I still need some way to export it.

Sorry for the long post, but maybe it will help clarify what I am doing.

Thanks again.

Scott

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

Post by FourthWorld » Thu Jan 15, 2009 11:54 pm

In v2.7 the "export snapshot" command was enhanced to allow you to specify an object rather than just a rect:

export snapshot from grp "MyGroup" to file "MyImage.jpg" as jpeg

This will cause the object specified to be rendered into an offscreen buffer directly, then that buffer is compressed into the specified format for writing to disk.

This differs from the other forms of "export snapshot" in that the others merely grab a portion of the card that's already rendered, which may contain other overlapping elements.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

Post by Scott Richardson » Fri Jan 16, 2009 1:13 am

I want to thank all of you guys. I really appreciate the forums.

I had actually tried all of these approaches, but the group still wouldn't render correctly. The problem seems to be solved — I don't know why exactly, though. Just on a whim, I decided to rename the group and try again. So I went back into the script and made sure I changed it there, too. It now works flawlessly. There were no misspellings or anything before (I even checked again before I made changes), so I am not sure what changing the name of the group had to do with anything (all I did was add two letters).

I am at a loss as to why it works now, but it does and that is fine with me.

Thanks again guys for the help and suggestions.

Scott

Post Reply