Java JAI - Error: One factory doesn't work for Mosaic operation
I am using Java Advanced Imaging. I already have tiles and want to assemble all tiles into one PlanarImage. In the code below, you receive the following error message:
Error: One factory does not work for operation "Mosaic" Exception from thread "main" javax.media.jai.util.ImagingException: All factories do not work for operation "Mosaic"
public static void loadTiles() {
RenderedImage[] source = new RenderedImage[new File("C:\\Users\\user\\workspace\\tiles\\67").listFiles().length-1];
System.out.println(source.length);
ImageLayout il = new ImageLayout(0, 0, 3306, 2336);
RenderingHints rh = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il);
RenderedOp ro = MosaicDescriptor.create(source, MosaicDescriptor.MOSAIC_TYPE_OVERLAY, null, null, null, null, rh);
System.out.println(ro.getData()); // <<<< Throws Exception
PlanarImage pi = ro.createInstance();
File outputFile = new File("C:\\Users\\dgrimm\\workspace\\tiles\\output");
System.out.println(outputFile.getAbsolutePath());
JAI.create("filestore", pi, outputFile.getAbsolutePath(), "png");
}
Can you help me fix the error?
+3
source to share