I have the following code. What it does is take an image and lower the resolution because I need it to weigh less. but the problem is that you lose the original ppp or dpi of 200 to 1 and must keep the same when downloading resolution
public void resize(InputStream input, OutputStream output, int width, int height) throws IOException {
BufferedImage src = ImageIO.read(input);
BufferedImage dest = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = dest.createGraphics();
AffineTransform at = AffineTransform.getScaleInstance((double)width / src.getWidth(), (double)height / src.getHeight());
g.drawRenderedImage(src, at);
ImageIO.write(dest, "tif", output);
output.close();
}
How could I do this?
Compressed image:
Image before downloading dimensions: