Is it possible to control the PPI (I want to increase it) on a BufferedImage? I use ImageIO.write to write the BufferedImage to a ByteArrayOutputStream.
No, not directly. A BufferedImage
consists of only pixel data (raster), a sample model and a color model. It has no knowledge of PPI/DPI.
But if the format you are writing supports setting PPI/DPI, you can typically control this by passing the proper IIOMetadata
along with the image to the ImageWriter
when writing.
See this answer for how to do this for JPEG.