Imagine Photo Help

I am trying to use Imagine Photo and AS to read a movie file and export all of the frames as BMP files. I am pretty sure there is a way to do this and i am pretty close, but i am not all the way there. Any help would be greatly appreciated.

here is what i have, it just loads a movie and draws each frame, i think there is a way to export the drawn frame.

on run
	set movieFile to choose file with prompt "Choose movie file to copy: " without invisibles
	set newFileLocation to choose file name with prompt "Save tall movie to: " default name "tallMovie.mov"
	--set drawingText to text returned of (display dialog "Enter the text to add to the bottom of the movie: " default answer "[url=http://www.yvs.eu.com]www.yvs.eu.com[/url]")
	tell application "iMagine Photo"
		launch
		set movieImporter to import movie movieFile
		if the component error of movieImporter is not equal to 0 then
			display dialog "The file is not a movie Quicktime recognizes"
			close movieImporter
			return
		end if
		set timeScaleScale to 600 / (time scale of movieImporter)
		set maximum samples of movieImporter to -1
		set {x, y, width, height} to natural bounds of movieImporter
		set newMovieWidth to (width)
		set newMovieHeight to (height)
		set thisDocument to make new window document with properties {dimensions:{newMovieWidth, newMovieHeight}}
		set the drawing destination of movieImporter to thisDocument
		set the destination rectangle of movieImporter to {0, 0, newMovieWidth, newMovieHeight}
		set theSamples to the drawing samples of movieImporter
		
		repeat with i from 1 to the (count of theSamples) - 1
			set the current time of movieImporter to item i of theSamples
			draw movieImporter
		end repeat
		
		close movieImporter
		close thisDocument
	end tell
end run

thanks

Hi,

You use the window document to export each file. It is also a graphic exporter. So before your repeat loop:


set export file type of thisDocument to "BMP"
set export folder location of thisDocument to (path to desktop folder) -- this will put your files on the desktop. You can specify anywhere you like.

In your repeat loop after draw MovieImporter add something like the following:


set export file name of thisDocument to "myFrames" & i & ".bmp"
export thisDocument

This should be pretty much all you need to do.

Kevin

Thank you for your quick reply, it works perfectly. I was wondering if anyone knew how to extract the audio from a quicktime compatable movie in the background to a Linear PCM Wave file. I am working on a video converter that requires this format. thanks

Sorry for the double post, but Imagine photo wont let me change the export location to a string. I have tried POSIX paths and Mac OS paths, but nothing works. Any suggestions?

thanks

where you have a Mac OS path try:

set the export folder location of thisDocument to file yourPathHere

Where you have a POSIX path try:

 set the export folder location of thisDocument to POSIX file yourPOSIXPath

If you have a file system specification or alias representing your folder you don’t need to convert it to a path. iMagine Photo will correctly interpret that. So for example:


set theFolder to choose folder
tell application "iMagine Photo"
  set thisDocument to make new window document
  set the export folder location of thisDocument to theFolder
end tell

Hope this helps

Kevin

Thanks! works perfectly.