Matte: FAQ

Here is a collection of frequently asked questions about Matte:

Is there any way to export albums from iPhoto into Matte?

Currently there is a fairly crude AppleScript that comes in the scripts directory of the Matte binary distribution which will export the currently-selected album in iPhoto into a directory and generate an import XML document that preserves the album name, and for each item in the album its name, keywords, and comments. You then need only zip up the exported items with the import XML file, and then import that zip archive into Matte.

See the iPhoto AppleScript Export page for more info.

I do have plans to work on a real iPhoto export plugin someday, or if anyone with OS X programming skills wanted to contribute, this would be a welcome addition to Matte (email msqr@users.sourceforge.net if you're interested).

Images take forever to be resized. How can I speed this up?

The default handler for images uses built-in Java classes to transform the images into other sizes. This approach can be very slow. A much faster approach is to use ImageMagick to transform images. Matte can be configured to use ImageMagick by way of JMagick, a Java-wrapper around the ImageMagick library. You'll need to have both installed in order to use this approach.

How do I configure JMagick?

Once you have ImageMagick and JMagick installed you'll need to configure your application server to support them. For Tomcat, an easy approach is to copy the jmagick.jar from JMagick into TOMCAT_HOME/common/lib and then add -Djmagick.systemclassloader=no to the CATALINA_OPTS environment variable when starting Tomcat. For example, here is a sample shell script to setup the required environment and then start Tomcat:

#!/bin/sh export JAVA_HOME=/opt/java/jdk-1.5 export CATALINA_HOME=/opt/tomcat export CATALINA_OPTS="-Djmagick.systemclassloader=no" ${CATALINA_HOME}/bin/catalina.sh start

If you have JMagick and/or ImageMagick installed in a non-standard location, you may need to tell Java where to find them by adding a -Djava.library.path parameter to your CATALINA_OPTS enviornment variable:

#!/bin/sh export JAVA_HOME=/opt/java/jdk-1.5 export JMAGICK_HOME=/opt/ImageMagick-6.2.6 export CATALINA_HOME=/opt/tomcat export CATALINA_OPTS="-Djmagick.systemclassloader=no -Djava.library.path=$JMAGICK_HOME/lib" ${CATALINA_HOME}/bin/catalina.sh start
Note in this example, JMagick has been installed into the ImageMagick library directory. This is not a bad approach for installing JMagick, as it depends on the version of ImageMagick you compile it against so you might as well keep them together.

Finally, you have to configure Matte to use JMagick versions of the image media handlers it uses. This is configured in the WEB-INF/classes/environmentContext.xml file located in the Matte WAR file. An example of using JMagick is included in the binary distribution of Matte, as setup/environmentContext-jmagick.xml. Use this as a guide to update your WEB-INF/classes/environmentContext.xml copy.

How do I configure JPEG-2000 images?

JPEG-2000 support requires you to be using ImageMagick/JMagick, as described above. ImageMagick also needs to have been compiled with JPEG-2000 support. The open-source Jasper library provides an implementation that ImageMagick can use.

Once you have ImageMagick configured with JPEG-2000 support, then you just need to configure Matte to use JMagick, as described above. Then make sure the jpegMediaHandler is configured to return JPEG-2000, like this:


<bean id="jpegMediaHandler" class="magoffin.matt.ma2.image.jmagick.JpegMediaHandler">
    <property name="domainObjectFactory" ref="domainObjectFactory"/>
    <property name="mediaBiz" ref="mediaBizTarget"/>
    <property name="jmagickMediaEffectMap" ref="jmagickEffectMap"/>
    <property name="useJpeg2000" value="true"/>
    <property name="jpeg2000UserAgentRegExp">
        <list>
            <value>WebKit</value>
        </list>
    </property>
</bean>

The useJpeg2000 property should be set to true. Also the jpeg2000UserAgentRegExp list should be configured to match the browser User-Agent HTTP header values you want to serve JPEG-2000 images to (since not all browsers support JPEG-2000 images natively). This list is composed of Java regular expressions, and if any of them match JPEG-2000 will be returned, otherwise normal JPEG images will be returned. In the example above, the text WebKit will match Apple's Safari browser, which supports JPEG-2000 images.

How do I configure support for video files?

Matte can use either of two libraries to support video files: Java Media Framework (JMF) or QuickTime for Java (QTJ). Similarly to how JMagick is configured (see above), once either (or both) of these are installed on your server then you need to configure your application server to support them, and then configure Matte to use them for video files.

For example in Tomcat to support JMF, copy the jmf.jar into TOMCAT_HOME/common/lib. If JMF is installed in a non-standard location, you may need to add the location to Java's library path. For example, here is a shell script that configures the environment for Tomcat to start:

#!/bin/sh export JAVA_HOME=/opt/java/jdk-1.5 export JMF_HOME=/opt/java/JMF-2.1.1e export CATALINA_HOME=/opt/tomcat export CATALINA_OPTS="-Djava.library.path=$JMF_HOME/lib" ${CATALINA_HOME}/bin/catalina.sh start

Similarly for QuickTime, copy the QTJava.zip and QTJSupport.jar files into TOMCAT_HOME/common/lib.

Finally, Matte must be configured to handle the video media types. This is configured in the WEB-INF/classes/environmentContext.xml file located in the Matte WAR file. An example of using JMF and QuickTime is included in the binary distribution of Matte, as setup/environmentContext-video.xml. Use this as a guide to update your WEB-INF/classes/environmentContext.xml copy.

I see an error "Can't connect to X11 window server using ':0'" -- how do I fix that?

Most likely this occurs on a Unix-like server where the user the application server is running as does not have access to X Windows (perhaps the server is started up without X Windows). One solution is to pass -Djava.awt.headless=true to Java when you start your application server. For example a shell script to start Tomcat might look like this:

#!/bin/sh export JAVA_HOME=/opt/java/jdk-1.5 export CATALINA_HOME=/opt/tomcat export CATALINA_OPTS="-Djava.awt.headless=true" ${CATALINA_HOME}/bin/catalina.sh start

Another solution is to make sure the user the application server runs as has access to an X Windows server. If you do have an X Server running, but Java still complains that it cannot connect to it, you might need to grant access to it for the user the application server runs as, for example

$ xhost +localhost

Another solution would be to run a virtual X Server, such as Xvfb. With this approach you probably need to specify the DISPLAY environment variable when starting your application server if it is not already set. For example a shell script to start Tomcat might look like:

#!/bin/sh export DISPLAY=:0 export CATALINA_HOME=/opt/tomcat ${CATALINA_HOME}/bin/catalina.sh start
SourceForge.net Logo