Libraryless. Click here for Pure Java version (78L/1K/3K).
1 | !752 |
2 | |
3 | //Please copy this and then fix some stuff then turn it into Javax. I don't know Java very well but you do. |
4 | |
5 | import java.awt.Font; |
6 | import java.awt.Graphics; |
7 | import java.awt.Graphics2D; |
8 | import java.awt.RenderingHints; |
9 | import java.awt.image.BufferedImage; |
10 | import java.io.File; |
11 | import java.io.IOException; |
12 | |
13 | import javax.imageio.ImageIO; |
14 | |
15 | public class main { |
16 | |
17 | static S imageURL = "http://eyeocr.sourceforge.net/filestore/filestore.php?cmd=serve&file=blob_1000021&contentType=image/png"; |
18 | |
19 | public static void main(String[] args) throws IOException { |
20 | |
21 | BufferedImage image = null; |
22 | try { |
23 | URL url = new URL(imageURL); // Ask for image |
24 | image = ImageIO.read(url); |
25 | } catch (IOException e) { |
26 | e.printStackTrace(); |
27 | } |
28 | |
29 | Graphics g = image.getGraphics(); |
30 | g.setFont(new Font("SansSerif", Font.BOLD, 24)); |
31 | |
32 | Graphics2D graphics = (Graphics2D) g; |
33 | graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, |
34 | RenderingHints.VALUE_TEXT_ANTIALIAS_ON); |
35 | graphics.drawString("JAVA", 10, 20); |
36 | |
37 | int width = image.getWidth(), height = image.getHeight(); |
38 | |
39 | for (int y = 0; y < height; y++) { |
40 | StringBuilder sb = new StringBuilder(); |
41 | for (int x = 0; x < width; x++) { |
42 | |
43 | sb.append(image.getRGB(x, y) == -16777216 ? " " : "$"); |
44 | |
45 | } |
46 | |
47 | if (sb.toString().trim().isEmpty()) { |
48 | continue; |
49 | } |
50 | |
51 | System.out.println(sb); //Print image out |
52 | } |
53 | |
54 | } |
55 | |
56 | } |
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: | 643 / 716 |
Referenced in: | [show references] |