How to save the line that i draw as a picture.
i was working on a picture where i need to draw some lines over the picture and save it as a new picture. my problem now is i only able to save the picture using the drawimage method while i cant save the lines that i draw using the drawline method. is there any ways that can save both the picture that i read and the line that i draw into a new picture ? below is part of my code.
File file1 = new File("C:/apple.jpg)
grid1 = ImageIO.read(file1);
BufferedImage bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_ARGB);
Graphics2D ig2 = bi.createGraphics();
ig2.drawImage(grid1, 0, 0, this);
ig2.drawLine(96, 127, 122, 127);
ig2.drawLine(122, 127, 135, 127);
File outputfile = new File("D:/New Folder/c.gif");
ImageIO.write(bi, "gif", outputfile);