public GhostReport ghostCalculation(int maxImageSmallDimension, int numThreads) throws IOException { File ghostOutputfile; byte[] imageInByte; String ghostBase64; // convert to base64 the image file GhostReport ghostReport = new GhostReport(); GhostExtractor ghostExtractor; ghostExtractor = new GhostExtractor(sourceFile, maxImageSmallDimension, numThreads); BufferedImage ghostMap; for (int ghostMapInd = 0; ghostMapInd < ghostExtractor.ghostMaps.size(); ghostMapInd++) { ghostOutputfile = new File(baseFolder, "GhostOutput" + String.format("%02d", ghostMapInd) + ".png"); ghostMap = ghostExtractor.ghostMaps.get(ghostMapInd); ImageIO.write(ghostMap, "png", ghostOutputfile); ByteArrayOutputStream ghostbytes = new ByteArrayOutputStream(); ImageIO.write(ghostMap, "png", ghostbytes); imageInByte = ghostbytes.toByteArray(); ghostReport.maps.add(ghostOutputfile.getCanonicalPath()); ghostReport.differences = ghostExtractor.allDifferences; ghostReport.minQuality = ghostExtractor.qualityMin; ghostReport.maxQuality = ghostExtractor.qualityMax; ghostReport.qualities = ghostExtractor.ghostQualities; ghostReport.minValues = ghostExtractor.ghostMin; ghostReport.maxValues = ghostExtractor.ghostMax; } ghostReport.completed = true; return ghostReport; }