!/usr/bin/env python3

coding: utf-8

from sys import argv, stderr, stdout

from PIL import Image

from shutil import get_terminal_size

def printImg(img):

(w, h) = img.size

for y in range(int(h/2)):

    prev = ()

    for x in range(w):

        (r0, g0, b0) = img.getpixel((x,y*2))

        (r1, g1, b1) = img.getpixel((x,y*2+1))

        if prev != ((r0, g0, b0), (r1, g1, b1)):

            line = f"\033[48;2;{r0};{g0};{b0};38;2;{r1};{g1};{b1}mâ–„"

            print(line, end='')

            prev = ((r0, g0, b0), (r1, g1, b1))

        else:

            print(f"â–„", end='')

    print("\033[0m\n", end='')

if name == "main":

for imgFile in argv[1:]:

    try:

        (tWidth, tHeight) = get_terminal_size((80,40))

        img = Image.open(imgFile)

        img = img.convert('RGB')

        img.thumbnail((tWidth,tHeight*2))

        printImg(img)

        img.close()

    except:

        print(f"Could not open {imgFile}", file=stderr)

Proxy Information
Original URL
gemini://texto-plano.xyz/draco/scripts/icat
Status Code
Success (20)
Meta
application/octet-stream
Capsule Response Time
871.341783 milliseconds
Gemini-to-HTML Time
0.625113 milliseconds

This content has been proxied by September (3851b).