Below is an example demonstrating how you can create a layered image and assign it to the scene backdrop, via script.
// Define an anonymous function; // serves as our main loop, // limits the scope of variables (function(){ // Get the image manager var oImageMgr = App.getImageMgr(); // Define the absolute path of the layer images var sBasePath = "C:/Users/Public/Pictures/Sample Pictures"; var sBaseLayerPath = String("%1/Penguins.jpg").arg( sBasePath ); var sMaskLayerPath = String("%1/Lighthouse.jpg").arg( sBasePath ); // Create file info objects for easy path operations var oBaseLayerFile = new DzFileInfo( sBaseLayerPath ); var oMaskLayerFile = new DzFileInfo( sMaskLayerPath ); // Define the names of the layers var sBaseLayerName = oBaseLayerFile.baseName(); var sMaskLayerName = String("%1 Mask").arg( oMaskLayerFile.baseName() ); // Get a unique name for the image var sTextureName = oImageMgr.getUniqueImageName( "My Layered Texture" ); // Create a layered texture var oLayeredTexture = oImageMgr.createLayeredTexture( sTextureName ); // Get the backdrop var oBackDrop = Scene.getBackdrop(); // Assign the texture to an owner so we do not cause a memory leak if something goes awry oBackDrop.setTexture( oLayeredTexture ); // Set the dimensions of the texture oLayeredTexture.size = new Size( 1024, 768 ); // If the version is 4.6.2.23 or newer if( App.version64 >= 0x0004000600020017 ){ // If the base layer file does not exist if( !oBaseLayerFile.exists() ){ // We are done.. return; } // Create a new layer var oLayer = oLayeredTexture.createLayer( sBaseLayerName ); // Set the absolute path of the image for the layer oLayer.imageFile = sBaseLayerPath; // If the mask layer file does not exist if( !oMaskLayerFile.exists() ){ // We are done.. return; } // Create a new mask var oMask = oLayer.createMask( sMaskLayerName ); // Set the absolute path of the image for the mask oMask.imageFile = sMaskLayerPath; // If the version is older than 4.6.2.23 } else { // Create a layered image var oLayeredImage = new DzLayeredImage(); // If the base layer file exists if( oBaseLayerFile.exists() ){ // Create a new layer var oImageLayer = new DzImageFileLayer(); // Set the absolute path of the image for the layer oImageLayer.filename = sBaseLayerPath; // Set the label for the layer oImageLayer.label = sBaseLayerName; // Add the layer oLayeredImage.addLayer( oImageLayer ); // If the mask layer file exists if( oMaskLayerFile.exists() ){ // Create a new mask var oImageMask = new DzImageMask(); // Set the absolute path of the image for the mask oImageMask.filename = sMaskLayerPath; // Set the label for the mask oImageMask.label = sMaskLayerName; // Set the layer mask oImageLayer.setMask( oImageMask ); } } // Convert the layered image into a layered texture oLayeredImage.toLayeredTexture( oLayeredTexture ); } // Finalize the function and invoke })();