public static Path convertRGBToJPEG(File fileEntry) {
		try {
			MediaType type = getFileType(fileEntry); 
			if (type != MediaType.Video && fileEntry.toString().endsWith(".rgb")) {
				String outputFileName = getFileNameWithoutExtension(fileEntry.toString()) + ".jpg";
				File outputFile = new File(outputFileName);
				Files.deleteIfExists(outputFile.toPath());
				
				BufferedImage image = null;
				if(type == MediaType.Image) {
					image = Collage.getImageWithFrameNumber(fileEntry.toPath(), 0,
							Constants.IMAGE_WIDTH, Constants.IMAGE_HEIGHT);
				} else if(type == MediaType.Collage) {
					image = Collage.getImageWithFrameNumber(fileEntry.toPath(), 0,
							Constants.COLLAGED_IMAGE_WIDTH, Constants.COLLAGED_IMAGE_HEIGHT);
					Image scaledImage = image.getScaledInstance(Constants.IMAGE_WIDTH, Constants.IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
					image = Collage.toBufferedImage(scaledImage);
				}
				ImageIO.write(image, "jpg", outputFile);
				return outputFile.toPath();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}