BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);
Image img = imageScreen.getScaledInstance(Double.valueOf(tileWidth * ClientConnectionBean.imgQuality).intValue(), Double.valueOf(tileHeight * ClientConnectionBean.imgQuality).intValue() ,Image.SCALE_SMOOTH);
BufferedImage image = new BufferedImage(Double.valueOf(tileWidth * ClientConnectionBean.imgQuality).intValue(), Double.valueOf(tileHeight * ClientConnectionBean.imgQuality).intValue(),BufferedImage.TYPE_INT_RGB);
Graphics2D biContext = image.createGraphics();
biContext.drawImage(img, 0, 0, null);
ByteArrayOutputStream out = new ByteArrayOutputStream();
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);