と言う訳で書いてみました
"-D" オプションでいろいろ設定できます。
import java.lang.String; import java.lang.System; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.File; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.awt.GraphicsEnvironment; import java.awt.Font; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.awt.RenderingHints; import javax.imageio.ImageIO; public class CreateImage { private static String P(String name, String def) { return System.getProperty(name, def); } public static void main(String[] args) throws Exception { final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in, P("charset", "UTF-8"))); final Collection<String> list = new LinkedList<String>(); final int width = Integer.parseInt(P("width", "600")); final int height = Integer.parseInt(P("height", "400")); GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font font = Font.createFont(Font.TRUETYPE_FONT, new File(P("fontpath", "ipagp-mona.ttf"))); env.registerFont(font); String line; while ((line = reader.readLine()) != null) { list.add(line); } final int lineLength = list.size(); final float fontHeight = height / lineLength; BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraphics(); g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VBGR); g.setColor(Color.WHITE); g.fillRect(0, 0, image.getWidth(), image.getHeight()); g.setColor(Color.BLACK); g.setFont(font.deriveFont(fontHeight)); Iterator<String> it = list.iterator(); for (int i = 0; it.hasNext(); i++) { g.drawString(it.next(), 10, i * fontHeight + fontHeight); } ImageIO.write(image, "png", new File(P("output", "hoge.png"))); } }