Tune print quality defaults: density 2, font 30pt, threshold 160

- Default density to thick (2) for bolder output
- Default font size to 30pt for better readability
- Add draw.fontmode="1" to disable antialiasing for crisp 1-bit text
- Add ImageOps.autocontrast before thresholding images
- Update web GUI defaults to match CLI
This commit is contained in:
Hamza
2026-02-24 22:02:24 +01:00
parent c4ee77db62
commit a710328b5c
3 changed files with 13 additions and 11 deletions

View File

@@ -287,8 +287,8 @@
<textarea id="textInput" placeholder="Type your label text..." rows="2">Hello</textarea>
<div class="range-row">
<label>Font size</label>
<input type="range" id="fontSize" min="10" max="72" value="24">
<span id="fontSizeVal">24</span>
<input type="range" id="fontSize" min="10" max="72" value="30">
<span id="fontSizeVal">30</span>
</div>
<div class="preview-wrap">
<canvas id="textPreview"></canvas>
@@ -331,8 +331,8 @@
<label>Density</label>
<select id="density">
<option value="0">Light</option>
<option value="1" selected>Medium</option>
<option value="2">Thick</option>
<option value="1">Medium</option>
<option value="2" selected>Thick</option>
</select>
</div>
<div class="setting-item">
@@ -663,7 +663,7 @@ function threshold(canvas) {
for (let i = 0; i < px.length; i += 4) {
// Grayscale via luminance
const gray = 0.299 * px[i] + 0.587 * px[i + 1] + 0.114 * px[i + 2];
const bw = gray < 128 ? 0 : 255;
const bw = gray < 160 ? 0 : 255;
px[i] = px[i + 1] = px[i + 2] = bw;
px[i + 3] = 255;
}