I use a third party API to generate a barcode. It gives me a java.awt.Image. Is there a way to set the background color of the java.awt.Image to RED? The API has none.
I went through the Java API but could not find it.
Create a BufferedImage with the same size. Paint the original image on the BufferedImage. Then, go through all pixels of the BufferedImage using getWidth(), getHeight() and getRGB(), and reset the pixel using setRGB if it's a white pixel.