Esempio n. 1
0
def loadFromUrl(URL, columns=60, color=True):
	fd = http.request('GET', URL)
	image_file = io.BytesIO(fd.data)
	im = Image.open(image_file)

	size = im.size
	rows = columns * size[1] / size[0]
	rows = int(round(rows))
	"""
	rows/columns = height/width
	"""
	im = im.resize((columns, rows))
	px = im.load()
	size = im.size
	output = ""
	for y in range(0, size[1]):
		for x in range(0, size[0]):
			_px = px[x,y]
			_a = asciify.getRawChar(_px[0], _px[1], _px[2], 1)
			if color == True:
				_a = asciify.asciify(_px[0], _px[1], _px[2], 1)

			output = output + _a
		output = output + "\n"
	return output
Esempio n. 2
0
def loadFromUrl(URL, columns=60, color=True):
	fd = http.request('GET', URL)
	image_file = io.BytesIO(fd.data)
	im = Image.open(image_file)

	size = im.size
	rows = columns * size[1] / size[0]
	rows = int(round(rows))
	"""
	rows/columns = height/width
	"""
	im = im.resize((columns, rows))
	px = im.load()
	size = im.size
	output = ""
	for y in range(0, size[1]):
		for x in range(0, size[0]):
			_px = px[x,y]
			_a = asciify.getRawChar(_px[0], _px[1], _px[2], 1)
			if color == True:
				_a = asciify.asciify(_px[0], _px[1], _px[2], 1)

			output = output + _a
		output = output + "\n"
	return output
Esempio n. 3
0
def loadFromFile(File, columns=60, color=True):
    im = Image.open(File)

    size = im.size
    rows = columns * size[1] / size[0]
    rows = int(round(rows))
    """
	rows/columns = height/width
	"""
    im = im.resize((columns, rows))
    px = im.load()
    size = im.size
    output = ""
    for y in range(0, size[1]):
        for x in range(0, size[0]):
            _px = px[x, y]
            _a = asciify.getRawChar(_px[0], _px[1], _px[2], 1)
            if color == True:
                _a = asciify.asciify(_px[0], _px[1], _px[2], 1)

            output = output + _a
        output = output + "\n"
    return output
Esempio n. 4
0
def onePixel(r, g, b):
	return asciify.asciify(r,g,b, 1)
Esempio n. 5
0
def onePixel(r, g, b):
	return asciify.asciify(r,g,b, 1)