Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

50
LINES

< > BotCompany Repo | #1002181 // ASCII art bot

JavaX source code - run with: x30.jar

//Please copy this and then fix some stuff then turn it into Javax. I don't know Java very well but you do.

import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class ASCIIArt {

  public static void main(String[] args) throws IOException {
  
	BufferedImage image = null;
        try {
            URL url = new URL(); // Ask for image
            image = ImageIO.read(url);
        } catch (IOException e) {
        	e.printStackTrace();
        }

	Graphics g = image.getGraphics();
	g.setFont(new Font("SansSerif", Font.BOLD, 24));

	Graphics2D graphics = (Graphics2D) g;
	graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
				RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
	graphics.drawString("JAVA", 10, 20);

	for (int y = 0; y < height; y++) {
		StringBuilder sb = new StringBuilder();
		for (int x = 0; x < width; x++) {

			sb.append(image.getRGB(x, y) == -16777216 ? " " : "$");
				
		}

		if (sb.toString().trim().isEmpty()) {
			continue;
		}

		System.out.println(sb); //Print image out
	}

  }

}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002181
Snippet name: ASCII art bot
Eternal ID of this version: #1002181/1
Text MD5: ab313110a2e8ab48004a1ede65eebcc5
Author: bgrgndz
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-23 18:12:47
Source code size: 1251 bytes / 50 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 752 / 708
Referenced in: #1002182 - ASCII art bot, stuff fixed
#3000190 - Answer for stefanreich(>> t 20 questions)
#3000202 - Answer for stefanreich (>> T conversion bot)
#3000238 - Answer for stefanreich (>> t power bot)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)