Page 1 of 1

Extracting images using Import Snapshot

Posted: Sun Sep 05, 2010 5:21 pm
by MCla
I am trying to extract images from a movie
Following discussions earlier I set up a player with the movie.
I then use import snapshot to get the current frame being played in the movie.
Everything works fine when the lockscreen is false when lock screen is true, I get monochrome data...
I cannot figure out what is going on there...
Thanks for any idea.

Code: Select all

on takeASnap
   lock screen
   set the showController of player"coralPlayer" to false
   --keep track of what the position of the player is before taking the snapshot...
   put the rect of player "coralPlayer" into tRect
   --blow the players to full size before taking the snapshot
   put the formattedWidth of player"coralPlayer" into tFormatWidth
   put the formattedHeight of player "coralPlayer" into tFormatHeight
   set the width of player  "coralPlayer" to tFormatWidth
   set the height of player  "coralPlayer" to tFormatHeight
   set the loc of player "coralPlayer" to the loc of this card
   import snapshot from player"coralPlayer"
   -- get the imagedata of the last image and put it into the working image
   put the short id of the last image into lastIm
   put the imagedata of image id lastIm into imdat
   set the imagedata of image "workImage" to imdat
   -- reset the rect of the player
   set the rect of player "coralPlayer" to tRect
   delete  image id lastim
   set the showController of player"coralPlayer" to true
   unlock screen
end takeASnap

Re: Extracting images using Import Snapshot

Posted: Mon Sep 06, 2010 12:05 pm
by bn
MCla,
try this, it works for me without flicker.

Code: Select all

on takeASnap
   lock screen
   set the showController of player"coralPlayer" to false
   
   --keep track of what the position of the player is before taking the snapshot...
   put the rect of player "coralPlayer" into tRect
   
   --blow the players to full size before taking the snapshot
   set the width of player "coralPlayer" to the formattedWidth of player "coralPlayer"
   set the height of player "coralPlayer" to the formattedHeight of player "coralPlayer"
   
   export snapshot from player "coralPlayer" to tSnap as png -- do an export to a variable tSnap
   
   set the text of image "workimage" to tSnap -- set the text takes care of width and height of image
   
   -- reset the rect of the player
   set the rect of player "coralPlayer" to tRect
   set the showController of player"coralPlayer" to true
   unlock screen
end takeASnap
I changed to an export snapshot. The problem probably arose because the imported image in lock screen mode was not "complete" yet. But who knows.
regards
Bernd

Re: Extracting images using Import Snapshot

Posted: Tue Sep 07, 2010 7:52 am
by MCla
This indeed works like a charm.
I used jpeg instead of PNG but same difference...
Thanks.