This accepts an InputStream. There's no need to parse the image file into a BufferedImage. If you had generated a BufferedImage through some other means (say, by generating one from scratch), you can use the ImageIO API to generate a byte array from the BufferedImage and then pipe that into an InputStream.
This accepts an InputStream. There's no need to parse the image file into a BufferedImage. If you had generated a BufferedImage through some other means (say, by generating one from scratch), you can use the ImageIO API to generate a byte array from the BufferedImage and then pipe that into an InputStream.