🛠️ToolsShed

Görüntüden ASCII Sanat

Herhangi bir görüntüyü özelleştirilebilir ASCII sanatına dönüştürür.

Buraya tıklayın veya bir resim sürükleyin

Sıkça Sorulan Sorular

Kod Uygulaması

from PIL import Image

CHARS = "@#S%?*+;:,. "

def image_to_ascii(path, width=80):
    img = Image.open(path).convert("L")
    w, h = img.size
    aspect = h / w
    new_h = int(width * aspect * 0.45)  # correct for char ratio
    img = img.resize((width, new_h))
    pixels = img.getdata()
    lines = []
    for i in range(0, len(pixels), width):
        row = pixels[i:i + width]
        line = "".join(CHARS[int(p / 255 * (len(CHARS) - 1))]
                       for p in row)
        lines.append(line)
    return "\n".join(lines)

print(image_to_ascii("input.jpg", width=100))

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.