private static BufferedImage createSolid(BufferedImage pOriginal, Color pBackground) {
        // Create a temporary image of same dimension and type
        BufferedImage solid = new BufferedImage(pOriginal.getColorModel(), pOriginal.copyData(null), pOriginal.isAlphaPremultiplied(), null);
        Graphics2D g = solid.createGraphics();

        try {
            // Clear in background color
            g.setColor(pBackground);
            g.setComposite(AlphaComposite.DstOver);// Paint "underneath"
            g.fillRect(0, 0, pOriginal.getWidth(), pOriginal.getHeight());
        }
        finally {
            g.dispose();
        }

        return solid;
    }
private static BufferedImage createSolid ( BufferedImage pOriginal , Color pBackground ) { BufferedImage solid = new BufferedImage ( pOriginal . getColorModel ( ) , pOriginal . copyData ( null ) , pOriginal . isAlphaPremultiplied ( ) , null ) ; Graphics2D g = solid . createGraphics ( ) ; try { g . setColor ( pBackground ) ; g . setComposite ( AlphaComposite . DstOver ) ; g . fillRect ( 0 , 0 , pOriginal . getWidth ( ) , pOriginal . getHeight ( ) ) ; } finally { g . dispose ( ) ; } return solid ; }
Creates a copy of the given image, with a solid background

@param pOriginal   the original image
@param pBackground the background color
@return a new {@code BufferedImage}