Free Support Forum - aspose.com

While drawing Image in Graphics resolution is not preserved

URL url = new URL(appModel.getScreenshots()[5]);
            InputStream inputStream = url.openStream();
            BufferedImage image = ImageIO.read(url);
            //FileInputStream inputStream = new FileInputStream(dataDir + playstoreBody.getNewImageName());
            Layer newLayer = new Layer(inputStream);
            Graphics graphics = new Graphics(scrshotLayer);
            graphics.clear(Color.getEmpty());
            newLayer.resize(image.getWidth(),image.getHeight(),6);
            //newLayer.setVerticalResolution(scrshotLayer.getVerticalResolution());
            //newLayer.setHorizontalResolution(scrshotLayer.getHorizontalResolution());
            graphics.drawImage(newLayer, new Rectangle(new Point(), new Size(scrshotLayer.getWidth(), scrshotLayer.getHeight())));

Resolution of image which I am drawing in last line is not getting preserved and as a result getting image compressed. Is there any way to preserve resolution. Here I am reading image from URL.

@mail9deep

I request you to please provide the source and generated image that we can observe and verify on our end to help you further.