Page 1 of 1

Export snapshot and player..

Posted: Mon Dec 30, 2013 6:20 pm
by MCla
I used to be able to export individual frames from a movie by

lock screen
expand the player to its formatted dimensions and hiding its controls
export snapshot of the player to an image files (JPEG)
return the player to its original size and location and controls
unlock screen

This worked really well all the way through the 5.5, 5.6 etc, livecode but seems to have stopped working at 6.0 and later (Mac OSX)

Any idea or workaround ?

Re: Export snapshot and player..

Posted: Tue Dec 31, 2013 5:33 am
by PBH
I ran into this problem recently and have filed a bug report.

Depending on how your stack is set up you may be able to use the following workaround…

Code: Select all

on snapShotWorkAround -- Temporary Workaround for SnapShot fail in LC 6.5.x
   lock screen
   put the rect of player "myPlayer" into tRect
   import snapShot from rect the rect of this stack
   set the name of the last image to "mySnapShot"
   crop image "mySnapShot" to tRect
   set the JPEGQuality to 75 -- or whatever you prefer
   export image "mySnapShot" to file (the documents folder & "/mySnapShot.jpg") as JPEG
   delete image "mySnapShot"
   unlock screen
end snapShotWorkAround
The only way to get a snapshot of a player seems to be to take a snap of the stack, just taking a snap from a rect or from the card doesn't see the player object. The danger is if there's any palettes or menus in front of your player, you'll capture them too.

From the tests I've done, LC 6.1.3 appears to work OK with import/export snapshot from player, but all versions of 6.5.x fail on Mac and Win7 too, don't know about Linux. Hopefully RR will be able to fix this soon.

HTH

Paul

Re: Export snapshot and player..

Posted: Tue Dec 31, 2013 10:49 am
by [-hh]
..........

Re: Export snapshot and player..

Posted: Tue Dec 31, 2013 7:31 pm
by PBH
[-hh] wrote:On Mac the problem is simply the file path to export to (tested snapshots on diff MacOS versions, also from player objects):
  • There is no problem with import snapshot
  • There is no problem with export snapshot IF
    => EITHER one exports to an existing image in current stack (create for example img "tmp")

    Code: Select all

    create img "One" ## if not yet existing
    export snapshot from player "One" to img "One" as PNG
    export img "one" to file "/Users/hh/Desktop/one.png" as PNG
    => OR one exports to a file giving *explicit full path* as target (avoiding 'defaultFolder')

    Code: Select all

    export snapshot from player "One" to file "/Users/hh/Desktop/one.png" as PNG
-hh,
Both these codes result in empty (as in totally transparent) PNGs here on Mac OS X 10.8.5 with any version of LC 6.5.x, they work as expected in versions of LC 6.1.3 or lower, RunRev have already confirmed the bug and are now working on it.

Maybe there's more to it if some users can import/export snapshots from player objects in LC 6.5.x, but this problem has absolutely nothing to do with the file path, I can import/export snapshots all day long for anything other than Player objects, the only way I can get a snap of a Player Object is to take a snapShot higher than the card level.
i.e. From the rect of the stack or from the whole screen.

Paul

Re: Export snapshot and player..

Posted: Tue Dec 31, 2013 8:22 pm
by [-hh]
..........

Re: Export snapshot and player..

Posted: Wed Jan 01, 2014 2:05 am
by PBH
Hi Herman,

No problem, I do realise that people can have very different experiences with software, even on what appears to be very similar systems. I did do extensive testing before submitting the bug report including testing different file formats, as I always do, but that doesn't mean I was able to cover everything, that's why I include statements like "From the tests I've done" when replying to posts like this. It appeared to me that the OP had seen the same issues that I was experiencing, so I just passed on one workaround and my experience as requested, there are probably many other ways to achieve similar results.

I am seeing this bug on OS X 10.6.8, 10.7.5, 10.8.5 and Windows 7 all are kept up to date and each is on a different machine. I don't have 10.9 just yet as I'm waiting to buy a new Mac Pro sometime early in the new year so I'm keeping my current line-up as is for testing.

I came up against this problem while using a player control for importing PSD, TIF, EPS and PDF images into my project, this works very well for the most part (until I tried to make a snapShot), but for now I have to continue development in LC 6.1.3 to avoid this bug and using any awkward workaround, sadly missing out on any improvements in LC 6.5.1 until it's fixed, hopefully that won't be too long.

Best wishes for the New Year.

Paul