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

56
LINES

< > BotCompany Repo | #1002182 // ASCII art bot, stuff fixed

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (78L/1K/3K).

!752

//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 main {

  static S imageURL = "http://eyeocr.sourceforge.net/filestore/filestore.php?cmd=serve&file=blob_1000021&contentType=image/png";

  public static void main(String[] args) throws IOException {
  
	BufferedImage image = null;
        try {
            URL url = new URL(imageURL); // 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);
	
	int width = image.getWidth(), height = image.getHeight();

	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
	}

  }

}

Author comment

Began life as a copy of #1002181

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002182
Snippet name: ASCII art bot, stuff fixed
Eternal ID of this version: #1002182/1
Text MD5: 712f2174871c398f013df769bc1067a0
Transpilation MD5: e5d98a7e4e822d8eff66da681eab8afa
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-23 20:38:41
Source code size: 1458 bytes / 56 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 571 / 619
Referenced in: [show references]