Easy, just get the Graphics object from the image and draw your line on the image. This example (and the output image) does this:
public static void main(String[] args) throws Exception { final BufferedImage image = ImageIO.read(new URL( "http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png")); Graphics g = image.getGraphics(); g.setFont(g.getFont().deriveFont(30f)); g.drawString("Hello World!", 100, 100); g.dispose(); ImageIO.write(image, "png", new File("test.png")); }
Output ( test.png ):

dacwe Jun 07 2018-12-12T00: 00Z
source share