Save screen capture to camera roll?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
calmrr3
Posts: 100
Joined: Mon Oct 28, 2013 2:39 pm

Save screen capture to camera roll?

Post by calmrr3 » Wed Feb 04, 2015 11:52 pm

Hi,

I am trying to figure out how to save a snapshot of a specific area of a card to the camera roll.

I have been experimenting with:

Code: Select all

on mouseUp
   
   EXPORT snapshot from rect 0,30,320,350  to file "File1.png" as PNG
   answer ("File Saved Successfully")
   go to card "Home"
   
end mouseUp
But I don't think this is suited to mobile. I also found "mobileExportImageToAlbum" but have had no luck at the moment.

If someone could point me in the right direction that would be appreciated ! Thanks

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

Re: Save screen capture to camera roll?

Post by Klaus » Thu Feb 05, 2015 3:19 pm

Hi calmrr3,

I never worked with "mobileExportImageToAlbum" or something,
but of course you can also export a snapshot to file on MOBILE! 8)

Just supply a valid pathname like:

Code: Select all

on mouseUp
   put specialfolderpath("documents") & "/a_cool_screenshot.png" into tFile
   EXPORT snapshot from rect 0,30,320,350  to file tFile as PNG
   answer "File Saved Successfully"
   go to card "Home"
end mouseUp
Best

Klaus

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Save screen capture to camera roll?

Post by jmburnod » Thu Feb 05, 2015 5:43 pm

Hi calmrr3,

I think you need set the paint compression and it should work :D
Try this:

Code: Select all

set the paintCompression to "PNG"
export snapshot from rect 0,30,320,350 to tImgData as PNG
mobileExportImageToAlbum tImgData
Best regards
Jean-Marc
https://alternatic.ch

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

Re: Save screen capture to camera roll?

Post by Klaus » Thu Feb 05, 2015 6:14 pm

I always thought that "the paintCompression" and "export snapshot... AS xyz"
would be independent of each other? Know what I mean? Not? :D

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Save screen capture to camera roll?

Post by jmburnod » Thu Feb 05, 2015 6:35 pm

Hi Friend,
I don't know why but it works 8)
I didn't find it alone, that was a suggestion of Simon in this thread
http://forums.livecode.com/viewtopic.ph ... on#p112481
All the best
Jean-marc
https://alternatic.ch

calmrr3
Posts: 100
Joined: Mon Oct 28, 2013 2:39 pm

Re: Save screen capture to camera roll?

Post by calmrr3 » Thu Feb 05, 2015 6:53 pm

Thanks you both, got it working :)

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

Re: Save screen capture to camera roll?

Post by Klaus » Thu Feb 05, 2015 7:11 pm

In that thread the OP used the "import snapshot" command which does not take any "...AS (format)" parameter,
so setting the paintcompression was mandatory there! 8)

Anyway, that's just too funky that it works this way :D

Post Reply