File tifFile = new File("C:\\Users\\msmith\\Desktop\\img2508.tif");
BufferedImage newImage = ImageIO.read(tifFile);
BufferedImage indexedImage = new BufferedImage(newImage.getWidth(),
newImage.getHeight(), BufferedImage.TYPE_INT_BGR);
Graphics2D g = indexedImage.createGraphics();
g.drawImage(newImage, newImage.getMinX(),newImage.getMinY(),Color.WHITE, null);
newImage=indexedImage;
ImageIO.write(newImage, "jpg", new File(imageFolder + "/" + baseName + ".jpg"));
This is my code and when I try to convert one file it complete messes up and it is only one file. I am trying to convert a file from tiff to jpg. I have tried other posts with simliar issues but no solution yet.
Original file
New file:
thats what it comes out to be. I have tried making the image file smaller in GIMP but it creates the same image just with the correct resolution. Any reason why or if I can set the color when the file is read? Also if I could set a new file size in java?