I want to write a line on an existing picture in java. The pic image is in .jpg format. I used the code below, the only problem is that the final image has a red tint on it ... something like an image that has lost its true color and is light red. Please help me fix this problem.
BufferedImage img = ImageIO.read(new File("pic1.jpg")); int width = img.getWidth(); int height = img.getHeight(); BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bufferedImage.createGraphics(); Font font = new Font("Serif", Font.PLAIN, 96); g2d.setFont(font); g2d.drawImage(img, 0, 0, null); g2d.drawString(text, 100, 250); g2d.dispose(); File file = new File("newimage.jpg"); ImageIO.write(bufferedImage, "jpg", file);
source share