/* * Copyright 2006 Jeffrey Palm */ import java.awt.*; import java.awt.image.*; import java.util.*; import java.util.List; import javax.swing.*; public final class AsciiArt { public static void main(String[] args) { if (args == null || args.length == 0) { args = new String[]{"test.jpg"}; } try { new AsciiArt().realMain(args); } catch (Exception e) {e.printStackTrace();} } void realMain(String[] args) throws Exception { for (int i=0; i"); out(""); out("
"); for (int i=0; i> 24) & 0xff; int red = (pixel >> 16) & 0xff; int green = (pixel >> 8) & 0xff; int blue = (pixel ) & 0xff; String color = "#" + hex(red) + hex(green) + hex(blue); out("#"); } out("
"); } out(""); System.out.flush(); } private String hex(int i) { return Integer.toHexString(i); } private void out(Object msg) { System.out.print(msg); } protected final void note(Object msg) { System.err.println("[" + getClass().getName() + "] " + String.valueOf(msg)); } }