Commit Graph

40 Commits (4be3e5a130450aa723a76e7f97ae4a075d6035e9)

Author SHA1 Message Date
Amir Alexander Abdelbaki 4be3e5a130 Fix A4 preview box to actually render landscape
A plain swap of the printer's column/line counts didn't visually
flip the box's orientation, since monospace glyphs are taller than
wide: 64x54 characters still renders taller than wide at that char
aspect. Compute the true visual aspect ratio of the rotated print
instead, and scale the box to fill the terminal at that ratio.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 15:53:53 +02:00
Amir Alexander Abdelbaki deaf867091 Swap preview box dimensions to landscape in A4 mode
The printed page is rotated 90 degrees before hitting the printer in
A4 mode, so the live-preview box should reflect that same landscape
swap instead of sizing itself to the printer's raw portrait grid.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 15:48:41 +02:00
Amir Alexander Abdelbaki 2163397ff1 Add Debian/Fedora dependency install scripts, rename Arch one
Splits install-deps.sh into per-distro scripts (install_deps_arch.sh,
install_deps_debian.sh, install_deps_fedora.sh) since package names and
managers differ; ascii-image-converter is built via go install on
Debian/Fedora since it's AUR-only on Arch.
2026-07-14 16:42:17 +02:00
Amir Alexander Abdelbaki fab8cae8d4 removed archbaseos installer script 2026-07-14 16:38:40 +02:00
Amir Alexander Abdelbaki 7cdd36a598 Write README documenting usage, config, and printer setup
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 16:35:46 +02:00
Amir Alexander Abdelbaki 02412f1731 cleaned up after hardware diagnoses 2026-07-14 16:31:05 +02:00
Amir Alexander Abdelbaki f9527f53bb Merge branch 'master' of https://git.abdelbaki.eu/The_miro/ASCII-Photobooth 2026-07-14 16:14:12 +02:00
Amir Alexander Abdelbaki 1aeb0affd2 added another diagnosing script 2026-07-14 16:14:04 +02:00
Username 521c79f034 third log 2026-07-14 15:55:30 +02:00
Amir Alexander Abdelbaki 5a495794c6 Merge branch 'master' of https://git.abdelbaki.eu/The_miro/ASCII-Photobooth 2026-07-14 15:35:59 +02:00
Amir Alexander Abdelbaki ed889cca62 we gon diagnose hw 2026-07-14 15:35:33 +02:00
Username ae820dc7d9 more logs info lol 2026-07-14 15:32:55 +02:00
Username 7bf0c0275d getting bios log 2026-07-14 15:22:48 +02:00
Amir Alexander Abdelbaki 6528f64594 add REAL_VIEWFINDER setting to size and center the live preview
Sizes the curses viewfinder box to match the print output's character
grid (A4/roll-paper target dims) instead of always filling the
terminal, and always centers the box. Defaults to true.
2026-07-14 13:04:12 +02:00
Amir Alexander Abdelbaki 8ecb5cd558 added templates for old hp printer and for rollpaper printer 2026-07-14 12:28:07 +02:00
Amir Alexander Abdelbaki c1d5c7d9cb add roll printer support via PRINTER_MAX_LINES=0
A continuous-feed printer has no fixed page length, so photobooth.py
now sizes captures to the carriage width (PRINTER_MAX_COLS) and lets
height follow the image's own aspect ratio instead of cropping to a
row count, and txt2printr.sh always feeds the paper out at the end of
a print since there's no page to auto-advance past.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 12:21:29 +02:00
Amir Alexander Abdelbaki 96194f6d77 rewrite photobooth.py capture pipeline: rotate the image, not the text
Rearranging already-rendered ascii characters (the old text-transpose
rotation) ignores non-square character cells and read as visibly
distorted. Instead, crop the raw camera frame to roughly the right
aspect ratio, rotate it (only for PRINTER_A4) with OpenCV, and only
then convert to ascii - so ascii-image-converter picks shading
characters for correctly-oriented pixel data instead of us hacking
around after the fact.

The live curses viewfinder is now a separate, always-upright,
aspect-corrected preview independent of PRINTER_A4; the rotated/resized
version used for printing is computed fresh from the raw frame only at
capture time.

txt2printr.sh gains ALREADY_ROTATED, set automatically by photobooth.py
so it doesn't redundantly apply its own text-rotation on top of the
image-level one. The bash pipeline (webcam2ascii.sh/exec-cycle.sh),
which can't rotate images itself, still falls back to that text
rotation unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 10:46:48 +02:00
Amir Alexander Abdelbaki 063626d150 add ruler mode to pagetest.sh for exact chars-per-line calibration
Repeating-digit and prefixed-number test lines make it hard to read
off exactly where a printer truncates a line. `./pagetest.sh ruler`
prints a single line marking every 10th column with its tens digit
and every 5th with '+', so the real cutoff column can be read directly
off the page instead of estimated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 10:28:33 +02:00
Amir Alexander Abdelbaki a7d5b9d1bc fix: use measured page capacity instead of derived CPI/LPI geometry
Real-world testing (pagetest.sh) showed the printer's actual per-page
line/column capacity didn't match what the A4-geometry math predicted,
and the redundant blank second page was traced to the printer
auto-advancing to a new page once content hits the bottom margin,
with our own unconditional trailing form-feed then ejecting that
already-started blank page on top of it.

Replace PRINTER_CPI/PRINTER_LPI with directly-measured
PRINTER_MAX_LINES/PRINTER_MAX_COLS in printer.conf (read via
pagetest.sh), and have txt2printr.sh skip the trailing form-feed
whenever the print job already reaches that line capacity.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 09:59:06 +02:00
Amir Alexander Abdelbaki 796b1c4830 add pagetest.sh: generate a page-break diagnostic printout
Numbered, fixed-width lines let us read a printer's actual page length
and line width limits straight off the paper, instead of guessing them
from A4 geometry - needed to nail down the real constants for the
PRINTER_A4 landscape math.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 09:47:14 +02:00
Amir Alexander Abdelbaki c9cf7f6484 fix: correct A4 landscape sizing math to avoid page overflow
a4_landscape_chars() was sizing the capture/preview to the *final*
landscape look (assuming the physical page gets fed sideways), but
txt2printr.sh actually rotates the ascii art 90 degrees in software on
a normally-fed page. Combining both produced ~107 printed lines,
overflowing the printer's page-length capacity onto a second sheet.

Since the software rotation is cancelled out by the reader turning the
finished page 90 degrees, the capture buffer's own dimensions equal
the final visual result, but its width becomes the printed line count
post-rotation - so it must be capped by the page's line capacity along
the long edge, with height derived from the target landscape aspect
ratio (corrected for non-square character cells) instead of just
filling the available character budget.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 09:41:13 +02:00
Amir Alexander Abdelbaki 07cf695840 feat: add PRINTER_A4 landscape option for A4 printers
Dot-matrix printers have no hardware page-rotation, so when PRINTER_A4
is enabled in the new printer.conf, txt2printr.sh rotates the ascii art
90 degrees in software before sending it, and photobooth.py caps its
live-preview viewfinder to an A4-landscape character grid (sized from
configurable PRINTER_CPI/PRINTER_LPI) instead of just filling the
terminal, so the preview matches what actually gets printed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 09:27:22 +02:00
Amir Alexander Abdelbaki 9d6fa2833f fix: correct malformed shebang in txt2printr.sh
Missing '!' meant the kernel couldn't recognize the interpreter
directive, causing ENOEXEC (errno 8) when executed directly, e.g.
via subprocess.run() from photobooth.py.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 09:10:59 +02:00
Amir Alexander Abdelbaki 9019cf2fa7 fix: correct printer device priority fallback in txt2printr.sh
-f only matches regular files, so it never matched the /dev/lp0 or
/dev/usb/lp0 character device nodes, leaving dev unset and always
failing. Use -e existence checks in proper if/elif priority order
(lp0 > usb/lp0 > stdout), with PRINTER_DEV as an unconditional override.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 09:03:47 +02:00
Amir Alexander Abdelbaki adf5a6ec84 acccidental file 2026-07-14 08:58:19 +02:00
Amir Alexander Abdelbaki c89e1e01ac added more options for printers - if none fount it should output to stdout 2026-07-14 08:57:56 +02:00
Amir Alexander Abdelbaki e295910234 add photobooth.py: curses TUI rewrite of the live preview loop
Replaces per-frame fswebcam process spawns with a persistent OpenCV/v4l2
capture handle for the highest achievable refresh rate, while still
shelling out to ascii-image-converter for conversion and txt2printr.sh
for printing. Renders a bordered live preview with a status/keybind-help
bar via curses, works on a plain TTY with no graphical environment.

Reuses webcam.conf/ascii.conf/keybinds.conf, parsed as plain key=value
(not sourced, so a config file can no longer execute arbitrary code).
Brightness/exposure now go through v4l2-ctl with percentage mapped onto
each control's actual min/max range; added DEVICE/BRIGHTNESS_CTRL_ID/
EXPOSURE_CTRL_ID to webcam.conf and KEY_QUIT to keybinds.conf for this,
kept separate from the bash-oriented keys so the existing bash scripts
are unaffected. Bash scripts are left in place as a fallback.

New deps: python-opencv, v4l-utils.
2026-07-03 13:07:53 +02:00
Amir Alexander Abdelbaki 1d77f411fa rebind capture to the space bar
space is easier to hit than c mid-pose for a photobooth; the hint bar
now renders "space" instead of a literal blank so the UI stays legible.
2026-07-03 11:52:57 +02:00
Amir Alexander Abdelbaki 7f67c5fd81 add ascii.conf and keybinds.conf for converter options and rebindable keys
ascii.conf exposes ascii-image-converter's dimension/complexity/map/
grayscale/negative/flip options (color and braille stay out since they
rely on ANSI/multi-byte Unicode that txt2printr.sh's raw print path
can't render). keybinds.conf lets exec-cycle.sh's capture/brightness/
exposure/reset keys be rebound instead of hardcoded, matched
case-insensitively; the on-screen hint bar renders from the same
config so it never drifts out of sync with the actual bindings.
2026-07-03 11:33:33 +02:00
Amir Alexander Abdelbaki ed7c0d0813 add live brightness/exposure controls and a webcam.conf config file
exec-cycle.sh's live preview now shows brightness/exposure and lets
+/-, ./, adjust them per-frame via fswebcam --set, with r to reset;
webcam.conf centralizes the starting values, step size, capture
resolution/quality, and the v4l2 control names (which vary by camera)
so hardware-specific tuning doesn't require editing the scripts.
2026-07-03 11:29:24 +02:00
Amir Alexander Abdelbaki 1ee9ed1036 ensure lp group membership and parport kernel modules in install-deps
txt2printr.sh writes directly to /dev/lp0, which needs the lp kernel
driver loaded (via parport/parport_pc) and lp group membership for
non-root write access; wire both up during dependency install.
2026-07-03 10:52:37 +02:00
Amir Alexander Abdelbaki 5b631adfe4 implement txt2printr.sh to send ascii art to a parallel port needle printer
writes raw bytes to /dev/lp0 (overridable via PRINTER_DEV): resets the
printer with ESC @, converts LF to CRLF to avoid staircasing on raw
device writes, then form-feeds to eject the page.
2026-07-03 10:49:27 +02:00
Amir Alexander Abdelbaki 7030454075 switched exec-cycle to a live >=2fps ascii preview loop and added txt2printr stub
replaced the guvcview+keypress capture flow with a continuous
capture/convert/display loop so the terminal shows a live ascii
preview; pressing c saves the frame and triggers the new
txt2printr.sh hook (currently a blank template).
2026-07-03 10:24:35 +02:00
Amir Alexander Abdelbaki 494fa5dc64 copied archbaseos-guided-install.sh from The_miro/Dotfiles.git for base OS installation 2026-03-27 13:24:14 +01:00
Amir Alexander Abdelbaki 24cf0eb3a8 removed the part in the yay installer that installs leahneukirchens nq 2026-03-27 10:58:13 +01:00
Amir Alexander Abdelbaki 02677caeeb wrote script to install dependencies 2026-03-27 10:56:51 +01:00
Amir Alexander Abdelbaki 34ca605c2e created installer files; copied yay-installer from The_miro/Dotfiles.git 2026-03-27 10:37:58 +01:00
Amir Alexander Abdelbaki 1d5beee242 added .ghs.sh to gitignore for helper scripts (ghs = git helper scripts) 2026-03-26 20:02:23 +01:00
Amir Alexander Abdelbaki 169b4bd3ac created proper gitignore 2026-03-26 19:21:23 +01:00
Amir Alexander Abdelbaki 7fad3b03f9 created repo 2026-03-26 19:15:28 +01:00