-
-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathindex.html
More file actions
425 lines (397 loc) · 32.6 KB
/
Copy pathindex.html
File metadata and controls
425 lines (397 loc) · 32.6 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>image2cpp</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<script src="./js/dithering.js" defer></script>
<script src="./js/script.js" defer></script>
<link rel="stylesheet" href="./css/style.css">
</head>
<body>
<header class="topnav">
<div class="topnav-inner">
<div class="topnav-left">
<span class="brand">image2cpp <span class="v2">v2</span></span>
<nav class="topnav-links">
<a href="https://github.com/javl/image2cpp" target="_blank">view GitHub Repository</a>
</nav>
</div>
<div class="topnav-right">
<button class="icon-btn" id="theme-toggle" title="Toggle dark mode" aria-label="Toggle dark mode">
<span class="theme-icon-dark">☽</span>
<span class="theme-icon-light">☼</span>
</button>
<button class="btn-reset" onclick="const fileInput = document.getElementById('file-input'); if (fileInput) fileInput.value = ''; location.reload();">Reset page</button>
</div>
</div>
</header>
<div class="layout">
<main class="wrapper">
<section class="section step first-step" id="step-0">
<section class="input-methods-row">
<div class="column-left">
<p><strong>image2cpp</strong> is a simple tool to convert images into byte arrays (and vice versa) for use with small (monochrome) displays such as OLEDs on your Arduino or ESP.<br>
It was originally made to work with the Adafruit OLED library (for which your can find an example Arduino sketch <a href="https://github.com/javl/image2cpp/blob/master/oled_example/oled_example.ino" target="_blank">here</a>) but
has been expanded by the community.</p>
</div>
<div class="column-right">
<p>More info (and credits) can be found in the <a href="https://github.com/javl/image2cpp" target="_blank">Github repository</a>. This is also where you can report any <a href="https://github.com/javl/image2cpp/issues" target="_blank">issues</a> you might come across.</p>
<p class="sp-block">
Did you find this tool useful? Feel free to support my open source software on Github, especially if used commercially.
</p>
<p>
<a href="https://github.com/sponsors/javl"><img src="https://camo.githubusercontent.com/7fcc34127227d7a0293435c20a74bce4bf3eb26d86f6c5000aa620da147223dd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5f2d73706f6e736f725f6f6e5f4769746875622d626c75653f6c6f676f3d676974687562" alt="GitHub Sponsor" data-canonical-src="https://img.shields.io/badge/_-sponsor_on_Github-blue?logo=github" style="max-width: 100%;"></a> <a href="https://www.buymeacoffee.com/javl" rel="nofollow"><img src="https://camo.githubusercontent.com/0eeabd01753f37f754419d1b3f1b9fd755b1653c23283c8c8b17b1fbb18191e4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275795f4d655f615f436f666665652d6f72616e67653f6c6f676f3d6275796d6561636f66666565" alt="BMC" data-canonical-src="https://img.shields.io/badge/Buy_Me_a_Coffee-orange?logo=buymeacoffee" style="max-width: 100%;"></a>
</p>
</div>
</section>
</section>
<section class="section step bottom-divider" id="step-1">
<!-- <div class="step-num">1</div> -->
<section class="sub-section input-methods-row">
<div class="column-left" id="file-input-column">
<h2>1. Select image</h2>
<div class="note upload-note">You can import multiple images at once.<br>All processing is done locally in your browser: your images are not uploaded or stored anywhere online.</div>
<input type="file" id="file-input" name="file-input" multiple/><br />
<div id="only-images-file-error" class="msg error-msg">Only images file type are allowed</div>
<div id="file-input-column-items"></div>
<template id="file-input-entry-template">
<div class="file-input-entry">
<img class="image-size-thumb" alt="" />
<span class="js-label"></span>
<button type="button" class="remove-button js-remove">remove image</button>
</div>
</template>
<div class="note" id="continue-note">Add more images or <a href="#step-2">continue to step 2</a></div>
</div>
<div class="column-right">
<!-- // <h2 class="sub-section-title">or paste existing byte array</h2> // -->
<h2>1. Paste existing byte array</h2>
<textarea id="byte-input" class="byte-input" placeholder="i.e. 0xff, 0x81, 0x0d, 0x8d, 0xb1, 0xb1, 0x80, 0xfc"></textarea><br />
<div class="text-input-size">
<input type="number" min="1" id="text-input-width" class="size-input" value="128" /> x
<input type="number" min="1" id="text-input-height" class="size-input" value="64" /> px
</div>
<div class="note">Set this to the size of your image.<br>Common sizes: <a href="#" class="size-preset" onclick="setTextInputSize(16, 16); return false;"><code>16x16</code></a> <a href="#" class="size-preset" onclick="setTextInputSize(32, 32); return false;"><code>32x32</code></a> <a href="#" class="size-preset" onclick="setTextInputSize(64, 48); return false;"><code>64x48</code></a> <a href="#" class="size-preset" onclick="setTextInputSize(128, 32); return false;"><code>128x32</code></a> <a href="#" class="size-preset" onclick="setTextInputSize(128, 64); return false;"><code>128x64</code></a>.</div>
<div>
<button onclick="handleTextInput('horizontal')">Read as horizontal</button>
<button onclick="handleTextInput('vertical')">Read as vertical</button>
</div>
<canvas id="text-input-preview-canvas" class="text-input-preview-canvas"></canvas>
<div id="text-input-error" class="text-input-error">Byte array is invalid (or empty).</div>
<div class="note" id="read-images-note">If your image looks glitchy try changing the dimensions above and press the read button again.<br>Read images also appear at step 3 below for further processing.</div>
</div>
</section>
</section>
<div class="settings-preview-row">
<section class="section step bottom-divider" id="step-2">
<!-- <div class="step-num">2</div> -->
<h2>2. Image Settings</h2>
<section class="sub-section">
<div class="table settings-grid">
<div class="table-row">
<div class="table-cell"><label>Canvas size(s): </label>
<div class="note" id="glyph-name-note">
Glyph name is used to identify the image in the output code.
</div>
</div>
<div class="table-cell">
<ul id="image-size-settings"></ul>
<template id="image-size-entry-template">
<li>
<div class="image-size-row image-size-header">
<img class="image-size-thumb" alt="" />
<span class="file-info file-name js-file-name"></span>
<button type="button" class="remove-button js-remove">remove image</button>
</div>
<div class="image-size-row"><span class="file-info">Canvas size:</span>
<input type="number" min="1" class="size-input js-width" name="width" />
<span>x</span>
<input type="number" min="1" class="size-input js-height" name="height" />
</div>
<div class="image-size-row">
<span class="file-info">glyph name:</span>
<input type="text" class="glyph-input js-glyph" name="glyph" />
</div>
</li>
</template>
<div class="no-file-selected msg">Select one or more images at <a href="#step-1">step 1</a> first.</div>
<button id="all-same-size" onclick="allSameSize()">Apply first image size to all images</button>
</div>
</div>
<div class="table-row">
<div class="table-cell">
<label>Canvas background color:</label>
<div class="note">Used for parts of the canvas that are not covered by your image.</div>
</div>
<div class="table-cell">
<input id="backgroundColorWhite" type="radio" name="backgroundColor" value="white" checked="checked" onchange="updateRadio('backgroundColor')"/>
<label for="backgroundColorWhite" class="smallLabel">White</label>
<input id="backgroundColorBlack" type="radio" name="backgroundColor" value="black" onchange="updateRadio('backgroundColor')"/>
<label for="backgroundColorBlack" class="smallLabel">Black</label>
<input id="backgroundColorTransparent" type="radio" name="backgroundColor" value="transparent" onchange="updateRadio('backgroundColor')"/>
<label for="backgroundColorTransparent" class="smallLabel">Transparent</label>
</div>
</div>
<div class="table-row">
<div class="table-cell"><label for="scale">Image Scaling:</label></div>
<div class="table-cell">
<select id="scale" name="scale" onchange="updateInteger('scale')">
<option value="1">original size</option>
<option value="2">scale to fit, keeping proportions</option>
<option value="3">stretch to fill canvas</option>
<option value="4">stretch to fill canvas horizontally</option>
<option value="5">stretch to fill canvas vertically</option>
</select>
</div>
</div>
<div class="table-row">
<div class="table-cell">
<label>Center image:</label>
<div class="note">Centering the image only works when using a canvas larger than the original image.</div>
</div>
<div class="table-cell">
<input id="centerHorizontally" type="checkbox" onchange="updateBoolean('centerHorizontally')" />
<label for="centerHorizontally">horizontally</label>
<input id="centerVertically" type="checkbox" onchange="updateBoolean('centerVertically')" />
<label for="centerVertically">vertically</label>
</div>
</div>
<div class="table-row">
<div class="table-cell"><label for="invertColors">Invert image colors:</label></div>
<div class="table-cell">
<input id="invertColors" type="checkbox" onchange="updateBoolean('invertColors')" /> <label for="invertColors">Invert</label>
</div>
</div>
<div class="table-row">
<div class="table-cell"><label for="ditheringMode">Dithering mode: </label>
</div>
<div class="table-cell">
<select id="ditheringMode" onchange="updateInteger('ditheringMode')">
<option value="0">Binary</option>
<option value="1">Bayer</option>
<option value="2">Floyd-Steinberg</option>
<option value="3">Atkinson</option>
</select>
</div>
</div>
<div class="table-row">
<div class="table-cell">
<label for="ditheringThreshold">Brightness / alpha threshold: </label>
<div class="note">Pixels with brightness above threshold turn white, below turn black (opaque/transparent for alpha mode).</div>
</div>
<div class="table-cell">
<input id="ditheringThreshold" class="size-input" type="number" min="0" max="255" name="ditheringThreshold" oninput="updateInteger('ditheringThreshold')" value="128"/>
</div>
</div>
<div class="table-row">
<div class="table-cell"><label for="rotation">Rotate image:</label></div>
<div class="table-cell">
<select id="rotation" name="rotation" onchange="updateInteger('rotation')">
<option value="0">0</option>
<option value="90">90</option>
<option value="180">180</option>
<option value="270">270</option>
</select>
<label for="rotation">degrees CW</label>
</div>
</div>
<div class="table-row">
<div class="table-cell"><label>Flip image:</label></div>
<div class="table-cell">
<input id="flipHorizontally" type="checkbox" onchange="updateBoolean('flipHorizontally')" />
<label for="flipHorizontally">horizontally</label>
<input id="flipVertically" type="checkbox" onchange="updateBoolean('flipVertically')" />
<label for="flipVertically">vertically</label>
</div>
</div>
</div>
</section>
</section>
<section class="section step bottom-divider" id="step-3">
<!-- <div class="step-num">3</div> -->
<h2>Preview</h2>
<div id="preview-note" class="note">Click image to view at actual size</div>
<section class="sub-section">
<div class="no-file-selected msg">No files selected</div>
<div id="images-canvas-container"></div>
</section>
</section>
</div>
<section class="section step" id="step-4">
<!-- <div class="step-num">4</div> -->
<h2>3. Output</h2>
<section class="sub-section">
<div class="table">
<div class="table-row">
<div class="table-cell"><label>Draw mode:</label></div>
<div class="table-cell">
<select id="drawMode" name="drawMode" onchange="updateDrawMode(this)">
<option value="horizontal1bit">Horizontal - 1 bit per pixel</option>
<option value="vertical1bit">Vertical - 1 bit per pixel</option>
<option value="horizontal565">Horizontal - 2 bytes per pixel (565)</option>
<option value="horizontalAlpha">Horizontal - 1 bit per pixel alpha map</option>
<option value="horizontal888">Horizontal - 3 bytes per pixel (rgb888)</option>
</select>
<div class="note">
<i>If your image looks all messed up on your display, like the image below, try using a different mode.</i>
<br><img
src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCABAAJYDAREAAhEBAx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FYanZ5LzvQY4/jYicz96DHH8bETmfvQY4/jYicz96DHH8bETmfvQY4/jYicz9KkRiHJRjmIMiJSKRFA1drlJ7v32qib5XkP1mMpTJ316Uo3o1Mqx0u0lDhlRQxk6EPBSodLtJS4ZWUOzI9lSoxbxV+csYFTljAqcsYFcPy34flvw/Lfh+W+ZDsTALaVdeC3wIWvdOeNzkhQQ+kgaSkC9wbj0weYPXKxK7icq0WeyCWPdhDoSIsoMciOO1HyYJUA6gx+QFHH4Zxc2pzV8vsuki4zBeT8/swZ+z1+TrTCkLZtvyG66yu8K2Ue4HNLsrvCtlHuBzS7K7wrZR7gc0uyu8K2Ue4HNLQAQD254lQ0oblaa0LJ/FhenbgrsalyFIOdwZDbsEWGTtxDTtOFxP6dTR3puPEFtjkTwDnJ1JYKREUv77AgBbjpUxip+e5BHjiY4jCaIYj7UuylGSDnOzIAtKhZwo6XREimdsWdEdCDNK2jbEOhBmlbRtiXUVDR17qE3hj492z4AxGKADHu2fAGIxQAN6nQQhQyvwUzIJdYgZeJ0KZkEusQMvHzehXrecFggzKZ++oVUZael/nSJNYkn8pQQMM30DGGMgCOaytQh8Ec1lahD4I5rK1CHwNKtLC2hpVpYW0NKtLC2qqCz6J5YG5Fv8O5o4cOHDhw4cCANuMlTGKn5fZ6SESki7H4X2ekhEpIux+F9npIRKSLsfhfZ6SES/JkXY/BLGSKt13oTbttHDhw4oUKFACJDSiWO7dRYR5KxnQ45jbCPJWM6HHMbYR5KxnQ45jbCPJWM6HHMbYR5KxnQ45jfZHWgqkIuBIUKFhAC3HSpjFT8IAW46VMYqfhAC3HSpjFT8IAW46VMYqfhAC3HSpjFT8IAW46VMYqfsCAFuOlTGKn7/2Q=="
width="150" height="64" alt="" />
</div>
</div>
</div>
<div class="table-row">
<div class="table-cell"><label>Code output format</label></div>
<div class="table-cell">
<select id="outputFormat" name="outputFormat" onchange="updateOutputFormat(this)">
<option value="plain">Plain bytes</option>
<option value="arduino" selected="selected">Arduino code</option>
<option value="arduino_single">Arduino code, single bitmap</option>
<option value="adafruit_gfx">Adafruit GFXbitmapFont</option>
</select>
<div id="format-caption-container">
<div data-caption="plain">
<i>Outputs just the raw bytes of the image(s).</i>
</div>
<div data-caption="arduino">
<i>Adds some extra Arduino code around the output.
If multiple images are loaded, generates a byte array for each and appends its glyph name (from step 2 above) to the identifier.</i>
</div>
<div data-caption="arduino_single">
<i>Adds some extra Arduino code around the output.
If multiple images are loaded, generates a single byte array.</i>
</div>
<div data-caption="adafruit_gfx">
<i>Creates a <code>GFXbitmapFont</code> formatted ouput. Used by a modified version of the Adafruit GFX library.
GitHub project and example <a href="https://github.com/wiredolphin/Adafruit-GFX-Library/tree/bitmap-font" target="_blank">here</a>.</i>
<br />
<i>First ASCII character</i> value is used only if a glyph identifier of length equal to 1 is not provided for each image. The value itself will be incremented by 1 for each glyph.
</div>
</div>
<div id="extra-settings-container">
<div id="adafruit-gfx-settings" class="table nested-table">
<div class="table-row">
<div class="table-cell"><label>First ASCII character (dec):</label></div>
<div class="table-cell">
<input id="first-ascii-char" class="text-input" type="text" name="first-ascii-char" value="48"/>
</div>
</div>
<div class="table-row">
<div class="table-cell"><label>x advance:</label></div>
<div class="table-cell">
<input id="x-advance" class="text-input" type="text" name="x-advance" value="0"/>
</div>
</div>
</div>
<div id="arduino-identifier" class="table nested-table">
<div class="table-row">
<div class="table-cell"><label>Identifier/Prefix:</label></div>
<div class="table-cell">
<input id="identifier" class="text-input" type="text" name="identifier" value="epd_bitmap_"/>
</div>
</div>
<div class="table-row">
<div class="table-cell"><label for="fullExample">Full example code:</label></div>
<div class="table-cell">
<input id="fullExample" type="checkbox" onchange="updateBoolean('fullExample')" />
<label for="fullExample" class="note">Include a full example displaying the first image.</label>
</div>
</div>
<div class="table-row">
<div class="table-cell"><label for="esp32Format">ESP32 formatting:</label></div>
<div class="table-cell">
<input id="esp32Format" type="checkbox" onchange="updateBoolean('esp32Format')" />
<label for="esp32Format" class="note">Use <code>uint8_t</code> instead of <code>unsigned char</code> and <code>PROGMEM</code>.</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="table-row" id="prefix-separator-container">
<div class="table-cell"><label>Extra formatting options:</label></div>
<div class="table-cell">
<div class="sub-field">
<input id="outputComments" type="checkbox" checked onchange="updateBoolean('outputComments')">
<label for="outputComments">Add comments to code output</label>
</div>
<div class="sub-field">
<input id="bitswap" type="checkbox" onchange="updateBoolean('bitswap')">
<label for="bitswap">Swap bits in bytes</label>
<i class="note">MSB -> LSB. Useful when working with the u8g2 library.</i>
</div>
<div class="sub-field">
<label for="prefix" class="sub-field-label">Byte prefix:</label>
<input id="prefix" class="size-input" type="text" value="0x" oninput="updateString('prefix')"/>
</div>
<div class="sub-field">
<label for="separator" class="sub-field-label">Separator between bytes:</label>
<input id="separator" class="size-input" type="text" value=", " oninput="updateString('separator')"/>
</div>
<div class="sub-field">
<label for="bytesPerRow" class="sub-field-label">Bytes per row:</label>
<input id="bytesPerRow" class="size-input" type="number" min="0" value="16" oninput="updateInteger('bytesPerRow')"/>
<i class="note">Set to 0 to wrap using the image's width instead, e.g. an 8px wide image adds a newline every 8th byte.</i>
</div>
<div class="sub-field">
<label for="showAsciiPreview" class="sub-field-label">Ascii preview:</label>
<input id="showAsciiPreview" type="checkbox" onchange="updateBoolean('showAsciiPreview')">
<i class="note">Add an ascii-art comment after each row of bytes. Forces one image row per output line, regardless of "Bytes per row".</i>
</div>
</div>
</div>
</div>
</section>
<section class="sub-section">
<button type="button" class="generate-button" onclick="generateOutputString()">Generate code</button>
<button type="button" id = "copy-button" onclick="copyOutput()">Copy Output to clipboard</button>
<button type="button" id = "download-button" onclick="downloadBinFile()">Download as binary file (.bin)</button>
<div id="no-images-error" class="msg error-msg">Select one or more images at <a href="#step-1">step 1</a> first.</div>
<textarea id="code-output" class="code-output"></textarea>
</section>
</section>
</main>
</div>
<script>
// Dark mode toggle (persisted)
(function () {
var root = document.documentElement;
var stored = localStorage.getItem('theme');
if (stored) root.setAttribute('data-theme', stored);
var btn = document.getElementById('theme-toggle');
if (btn) btn.addEventListener('click', function () {
var next = root.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
root.setAttribute('data-theme', next);
localStorage.setItem('theme', next);
});
// Sidebar scrollspy
var links = Array.prototype.slice.call(document.querySelectorAll('.sidebar-link'));
var steps = links.map(function (l) { return document.getElementById(l.dataset.step); });
// Preview (step 3) is pinned beside Settings as a sticky side panel, not
// an independent scroll region - and Chrome updates a sticky element's
// offsetTop to its stuck position once scrolled past, which would
// otherwise make it permanently outrank Settings here. Skip it.
var previewIndex = links.findIndex(function (l) { return l.dataset.step === 'step-3'; });
function onScroll() {
var pos = window.scrollY + 120;
var active = 0;
var bestTop = -Infinity;
steps.forEach(function (s, i) {
if (i === previewIndex) return;
if (s && s.offsetTop <= pos && s.offsetTop > bestTop) {
bestTop = s.offsetTop;
active = i;
}
});
links.forEach(function (l, i) { l.classList.toggle('active', i === active); });
steps.forEach(function (s, i) { if (s) s.classList.toggle('active', i === active); });
}
window.addEventListener('scroll', onScroll, { passive: true });
onScroll();
})();
</script>
</body>
</html>