Page 1 of 1

Save screen capture to camera roll?

Posted: Wed Feb 04, 2015 11:52 pm
by calmrr3
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

Re: Save screen capture to camera roll?

Posted: Thu Feb 05, 2015 3:19 pm
by Klaus
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

Re: Save screen capture to camera roll?

Posted: Thu Feb 05, 2015 5:43 pm
by jmburnod
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

Re: Save screen capture to camera roll?

Posted: Thu Feb 05, 2015 6:14 pm
by Klaus
I always thought that "the paintCompression" and "export snapshot... AS xyz"
would be independent of each other? Know what I mean? Not? :D

Re: Save screen capture to camera roll?

Posted: Thu Feb 05, 2015 6:35 pm
by jmburnod
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

Re: Save screen capture to camera roll?

Posted: Thu Feb 05, 2015 6:53 pm
by calmrr3
Thanks you both, got it working :)

Re: Save screen capture to camera roll?

Posted: Thu Feb 05, 2015 7:11 pm
by Klaus
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