This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageDraw, ImageFont | |
from colour import Color | |
import numpy as np | |
# The function convert an image to ascii art | |
# f: Input filename | |
# SC: the horizontal pixel sampling rate. It should be between 0(exclusive) and 1(inclusive). The larger the number, the more details in the output. | |
# If you want the ascii art output be the same size as input, use ~ 1/ font size width. | |
# GCF: >0. It's an image tuning factor. If GCF>1, the image will look brighter; if 0<GCF<1, the image will look darker. | |
# out_f: output filename |