-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
63 lines (63 loc) · 5.96 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script type="text/javascript" src="dotart.js"></script>
<link type="text/css" rel="stylesheet" href="dotart.css" />
<title>DotArt</title>
</head>
<body class="modal-open">
<aside id="no-js-modal">
<p>JavaScript is required to use DotArt. If you see this message, either your browser does not support JavaScript, or its JavaScript support is not sufficiently modern enough to support the features that DotArt needs to make use of. More information may be found in your browser’s JavaScript console.</p>
</aside>
<main>
<header><h1>DotArt</h1><p>Image to braille character converter</p></header>
<form>
<a href="#" id="modal-open">Help / About</a>
<label>File select <input type="file" id="file-input" name="file-input" accept="image/jpeg,image/png,image/gif" /></label>
<label>Threshold<input type="number" min="0" max="255" value="127" id="threshold" name="threshold" size="3" /></label>
<label>Max characters<input type="number" min="140" max="65536" name="char-count" value="2000" size="4" /></label>
<fieldset>
<legend>Dithering</legend>
<label><input type="radio" name="dither" value="none" />None</label>
<label><input type="radio" name="dither" value="ordered" />Ordered</label>
<label><input type="radio" name="dither" value="atkinson" checked="checked" />Atkinson</label>
</fieldset>
<fieldset>
<legend>Coloring</legend>
<label><input type="radio" name="coloring" value="wonb" checked="checked" id="coloring-wonb" />White on Black</label>
<label><input type="radio" name="coloring" value="bonw" id="coloring-bonw" />Black on White</label>
</fieldset>
<label>Horizontal gap<input type="number" min="0" max="9" name="horiz-gap" value="2" size="1" /></label>
<label>Vertical gap<input type="number" min="0" max="9" name="vert-gap" value="1" size="1" /></label>
<footer><p>A <a href="https://albright.pro/">Garrett Albright</a> project (hire me!)<br /><a href="https://github.com/GarrettAlbright/DotArt">Repo @ GitHub</a></p></footer>
</form>
<!-- <canvas id="canvas"></canvas> -->
<div id="result">
<pre></pre>
<input type="button" id="copy-to-clip" value="Copy to clipboard" />
</div>
</main>
<aside id="about-modal" class="closed">
<div id="modal-close">Close</div>
<h2>What is DotArt?</h2>
<p>DotArt is a browser-based tool for converting images to text using Unicode braille characters, the “dots” of which will form a rough representation of the image. It’s kind of hard to explain - you’ll understand it quicker if you just give it a try.</p>
<p>The text-based images this tool creates can be used in places where images cannot; for example, on forums or chat systems (such as Discord and Slack) where users may post text but not images. It can also be used simply when the aesthetic if the images it creates are desirable.</p>
<h2>How does DotArt work?</h2>
<p>After you choose a picture, DotArt scales the image so that it will fit under the Unicode character limit. It then internally converts the image to a grayscale representation of itself (that is, an image which consists only of shades of gray). The image is then processed again to consist only of a black or white version of itself (that is, only black and white pixels; no shades of gray) based on other settings you provide. The “dots” of that image are used to build the Unicode braille characters representing the image. Well, some of those steps actually happen a little out of order, but that’s the basics of it.</p>
<h2>What do the controls do?</h2>
<p>DotArt provides various controls to tweak the appearance of its results. You are encouraged to experiment with the controls to get the best results.</p>
<ul>
<li><b>File upload:</b> Choose the file you wish to convert. Note that this tool works entirely in your browser and the image is not “uploaded” to a server for processing. (Don’t believe me? <a href="https://github.com/GarrettAlbright/DotArt">Check out the code yourself.</a>)</li>
<li><b>Threshold:</b> When converting from the grayscale to black-and-white representations of the image, this value represents the “cutoff” between what shades of gray are converted to black and what shades of gray are converted to white. Adjusting this value will result in a darker or lighter image.</li>
<li><b>Max characters:</b> The maximum number of text characters which can be used to represent your image. If the system you are trying to use complains about the message being too long when you paste in DotArt’s results, try reducing this number.</li>
<li><b>Dithering:</b> With dithering enabled, different shades of gray will be represented by different patterns of dots in the final image. Ordered dithering will result in a more uniform pattern; Atkinson dithering looks more random but generally shows the edges between light and dark areas better.</li>
<li><b>Coloring:</b> Adjust whether DotArt’s results will be used on a system which represents light text on a dark background (White on Black; Discord, by default), or dark text on a light background (Black on White; Slack and most web sites).</li>
<li><b>Horizontal & Vertical Gap:</b> Adjusts how wide, in braille “dots,” the gaps are between characters. The default values of 1 will suffice in most cases, but you might need to experiment a bit to get proper-looking results depending on the styles and fonts used by the final system.</li>
</ul>
<h2>Who made this?</h2>
<p><a href="https://albright.pro/">Garrett Albright</a>, a freelance web developer, with vanilla CSS, vanilla JS, and HTML5. Hire me!</p>
</aside>
</body>
</html>