D7WS HOMEPAGE WORKSHOP NEUE XTRAS GALERIE WORKSHOP Automatic Translation LESERSERVICE BUCH NEWS

HowTo: Export JPEGs (Director 8)

 

 

 

Home
Workshop-Seite

Deutsche Version

download demo movie

published in Screen Business Online


This trick only works with Director 8, NOT with Director 8.5, MX, ...


The following technique uses undocumented features of Director. So it is not a recommended use of Director ;-) BUT the below script shows very clear that there are real treasures to find once you get into the exploration of all those Macromedia Xtras that come with the product.

It is obviously possible to export JPEGs with only the Xtras Macromedia puts into the Director package. With the help of all the fellow-developers that contributed to my initial proposal of this technique (see here), and some necessary changes for Director 8, it is a reliable technique that has been used in quite a few professional projects.

In Director 8 you'll need the following Xtras: Image Translator Helper, JavaConvert, JPEG Export and Mix Services. Install the Java components off your Director CD to get all of them. These xtras are NOT shockwave-save, thus the technique will only work in authoring and projectors. If you're still using Director 6 or 7: have a look at the old JPEG export page. You may also use the below movie and behavior in Director 7.

The main exporting routine in-nuce looks like this:

-- Movie script
-- Call:
-- converttojpeg("hans", "aDisk:aFolder:aFile.jpg", 75)
-- converttojpeg("hans", "c:\aFolder\aFile.jpg", 75)
on convertToJPEG mymember, myfilepath, myquality
  myinst = new(xtra "JavaConvert")
  the itemdelimiter = "."
  myinst.ExportMedia(item 1 of the movie, mymember, \
  myfilepath, 1, myquality, mymember.castlibnum)
  myinst = 0
end

details...




 

 

 

 

The details

If you want to use JPEG export in a projector, make sure that:

• the exporting movie is not included in the projector file.
• the exporting movie is not shocked (.dcr) nor protected (.dxr). At least it must have the extension .dir.
• in Director 8, you pass member names or numbers (instead of member references) into the convertToJpeg routine
• Additionally, there are sporadic crashes when closing a projector after having exported JPEGs. Have a look at the export behavior in the example movie, where I incorporated an ugly hack that does the job. No more crashes...

For both authoring and projector make sure that:

• the member to be exported is in Castlib 1. There is no way to export from other castlibs. The script below eliminates the term mymember.castlibnum and just uses 1 instead.
• when exporting more than one member, you may choose not to instantiate the Xtra for every export. The script below has the necessary changes.

-- Movie script
global myinst
on convertToJPEG mymember,myfilepath, myquality
  if voidP(myinst) then myinst = new(xtra "JavaConvert")
  the itemdelimiter = "."
  myinst.ExportMedia(item 1 of the movie, mymember, \
  myfilepath, 1, myquality, 1)
end
on exportingDone
  myinst = 0
end

The behavior...




 

 

 

 

The Behavior

The following Behavior incorporates all of the above and does the necessary checks. You'll be alerted if something is wrong with your setup.

In an older version, the behavior won the behavior submission contest at http://www.mediamacros.com in August 1999. Gretchen Macdowall used the technique here: http://www.updatestage.com/ previous/990401.html#item2. The behavior has been revised for Director 8 and the known problems are fixed.

Download: Example movie with JPEG Export Behavior (ZIP file, ca. 80 KB). English Documentation in the script.

You might invest some minutes to do your own imaging application with Save capability: just use the paintbox behaviors that come with Director 8 and my JPEG export ;-)

If you rather won't rely on undocumented features, you may find a solution in Ravwares ImageExporter-Xtra or DirectXport from DirectXtras.

Joachim Gola




 


Directorworkshop.de ist © Joachim Gola & Gerd Gillmaier 1998-2002. Alle Rechte vorbehalten.