@@ -0,0 +1,2302 @@
+//%0A// WriteRGBMovie.java%0A//%0A%0Aimport loci.formats.*;%0Aimport loci.formats.meta.IMetadata;%0A%0A/**%0A * Demonstrates writing multiple RGB image planes to a movie.%0A *%0A * %3Cdl%3E%3Cdt%3E%3Cb%3ESource code:%3C/b%3E%3C/dt%3E%0A * %3Cdd%3E%3Ca href=%22https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/components/bio-formats/utils/WriteRGBMovie.java%22%3ETrac%3C/a%3E,%0A * %3Ca href=%22https://skyking.microscopy.wisc.edu/svn/java/trunk/components/bio-formats/utils/WriteRGBMovie.java%22%3ESVN%3C/a%3E%3C/dd%3E%3C/dl%3E%0A */%0Apublic class WriteRGBMovie %7B%0A%0A  public static void main(String%5B%5D args) throws Exception %7B%0A    if (args.length %3C 1) %7B%0A      System.out.println(%22Please specify an output file name.%22);%0A      System.exit(1);%0A    %7D%0A    String id = args%5B0%5D;%0A%0A    // create 20 blank 512x512 image planes%0A    System.out.println(%22Creating random image planes...%22);%0A    int w = 511, h = 507, numFrames = 20, numChannels = 3;%0A    int pixelType = FormatTools.UINT8;%0A    int bpp = FormatTools.getBytesPerPixel(pixelType);%0A    int planeSize = h * w * numChannels * bpp;%0A    byte%5B%5D%5B%5D img = new byte%5BnumFrames%5D%5BplaneSize%5D;%0A%0A    // fill with random data%0A    for (int t=0; t%3CnumFrames; t++) %7B%0A      for (int i=0; i%3Cimg%5Bt%5D.length; i+=numChannels) %7B%0A        for (int c=0; c%3CnumChannels; c++) %7B%0A          img%5Bt%5D%5Bi + c%5D = (byte) (256 * Math.random());%0A        %7D%0A      %7D%0A    %7D%0A%0A    // create metadata object with required metadata fields%0A    System.out.println(%22Populating metadata...%22);%0A    IMetadata meta = MetadataTools.createOMEXMLMetadata();%0A    meta.createRoot();%0A    meta.setPixelsBigEndian(Boolean.TRUE, 0, 0);%0A    meta.setPixelsDimensionOrder(%22XYZCT%22, 0, 0);%0A    meta.setPixelsPixelType(FormatTools.getPixelTypeString(pixelType), 0, 0);%0A    meta.setPixelsSizeX(w, 0, 0);%0A    meta.setPixelsSizeY(h, 0, 0);%0A    meta.setPixelsSizeZ(1, 0, 0);%0A    meta.setPixelsSizeC(numChannels, 0, 0);%0A    meta.setPixelsSizeT(numFrames, 0, 0);%0A    meta.setLogicalChannelSamplesPerPixel(numChannels, 0, 0);%0A%0A    // write image planes to disk%0A    System.out.print(%22Writing planes to '%22 + id + %22'%22);%0A    IFormatWriter writer = new ImageWriter();%0A    writer.setMetadataRetrieve(meta);%0A    writer.setId(id);%0A    for (int t=0; t%3CnumFrames; t++) %7B%0A      System.out.print(%22.%22);%0A      writer.saveBytes(img%5Bt%5D, t == numFrames - 1);%0A    %7D%0A    writer.close();%0A%0A    System.out.println(%22Done.%22);%0A  %7D%0A%0A%7D%0A

Add example for writing 24-bit RGB movies.