Objects that are exported to file becomes corrupt

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

Objects that are exported to file becomes corrupt

Post by Peter@multidesk.se » Tue Nov 04, 2014 9:54 am

Is there anyone who understands why an object exported as .png and saved locally can not be read back? It seems that the file somehow become corrupt.
It does not matter if I export it as anything other than .png, it just does not work.

And this does not work regardless of platform.

set the defaultFolder to specialFolderPath("documents")
export snapshot from group tGroup of stack "Drawing" to URL("file:image.png") as png

///Peter
/*Whats all the fuss with c# ?*/

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Objects that are exported to file becomes corrupt

Post by bn » Tue Nov 04, 2014 10:49 am

Hi Peter,

if you use "url" you need to specify "binfile" instead of "file" because if you use file LC will convert line endings to a platform specific form and the image will not work anymore.

both of the code variants work

Code: Select all

 set the defaultFolder to specialFolderPath("documents")
export snapshot from group 1 to url "binfile:image.png" as png

Code: Select all

 set the defaultFolder to specialFolderPath("documents")
export snapshot from group 1 to file "image.png" as png
Kind regards
Bernd

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

Re: Objects that are exported to file becomes corrupt

Post by Klaus » Tue Nov 04, 2014 2:10 pm

If in doubt ALWAYS look up the dictionary!

The entry about "export snapshot..." does not leave any doubt about the snytax:
...
export snapshot [from rect[angle] rectangle] of object [(with | without) effects] ... | [from object] [at size width, height] [{with|and} metadata metadata] to {file filePath | container} [as format] [with mask maskFile]
...

Post Reply