Created
January 1, 2022 20:12
-
-
Save michael-simons/fa30a98f31b888d7c6bc02e2daeca485 to your computer and use it in GitHub Desktop.
Add text with emojis to an image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.Font; | |
import java.io.File; | |
import java.io.IOException; | |
import javax.imageio.ImageIO; | |
public class Peng { | |
public static void main(String... a) throws IOException { | |
var image = ImageIO.read(new File(a[0])); | |
var font = new Font("Arial", Font.BOLD, 36); | |
var g = image.getGraphics(); | |
g.setFont(font); | |
g.setColor(Color.RED); | |
g.drawString("🚀 Ready to go!!!", 10, 40); | |
ImageIO.write(image, "jpg", new File("foo.jpg")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment