Convert the 8-bit grayscale input image (2D-list) into an ASCII-representation.

```
_____/\\\\\\\\\________/\\\\\\\\\\\__________/\\\\\\\\\__/\\\\\\\\\\\__/\\\\\\\\\\\_        
 ___/\\\\\\\\\\\\\____/\\\/////////\\\_____/\\\////////__\/////\\\///__\/////\\\///__       
  __/\\\/////////\\\__\//\\\______\///____/\\\/_______________\/\\\_________\/\\\_____      
   _\/\\\_______\/\\\___\////\\\__________/\\\_________________\/\\\_________\/\\\_____     
    _\/\\\\\\\\\\\\\\\______\////\\\______\/\\\_________________\/\\\_________\/\\\_____    
     _\/\\\/////////\\\_________\////\\\___\//\\\________________\/\\\_________\/\\\_____   
      _\/\\\_______\/\\\__/\\\______\//\\\___\///\\\______________\/\\\_________\/\\\_____  
       _\/\\\_______\/\\\_\///\\\\\\\\\\\/______\////\\\\\\\\\__/\\\\\\\\\\\__/\\\\\\\\\\\_ 
        _\///________\///____\///////////___________\/////////__\///////////__\///////////__
```
_(Example ASCII-art)_

For every component in the image output a character corresponding to its intensity.

Specifically, you are supposed to normalize the input values (of dynamic range 0 - 255) down to a dynamic range of the number of glyphs (0 - 8). For simplicity your implementation should use flooring (integer division) in order to make all values (0 ~ 8) integers, ie.
```
  0 → 0.0 → 0
 10 → 0.4 → 0
...
254 → 7.9 → 7
255 → 8.0 → 8
```

Your symbols (_glyphs_) for representing pixel intensities:
```python
GLYPHS = " .,:;xyYX"
```

The _normalization_ is linear (and floored), meaning with an input value of 180 and 9 glyphs, glyph #5 (0-indexed) is ```x```, meaning ```180 → 'x'```.

Each scanline (_row_) in the image should be represented by a newline ```\n``` in the output string. Ie. a single string, not a list of strings.

__Disclaimer:__ This is my first Kata, so any feedback is greatly appreciated. I may add some more specific test cases to show of your fine art. ;)

__Note:__ Your ASCII-art generator is best suited for bright text on dark background.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Starter code: def image2ascii(image):
	

Solutions:
def image2ascii(image):
	return '\n'.join((''.join((glyphs[v * 8 // 255] for v in r)) for r in image))


GLYPHS = ' .,:;xyYX'

def image2ascii(image):
	return '\n'.join((''.join((GLYPHS[x * 8 // 255] for x in row)) for row in image))


GLYPHS = ' .,:;xyYX'

def quantize(value, max_value, max_quantum):
	if value == max_value:
		return max_quantum
	return int(value // 32)

def generate_lut(max_value, max_quantum):
	return [quantize(v, max_value, max_quantum) for v in range(max_value + 1)]

def transform(image, lut):
	return [[lut[v] for v in row] for row in image]

def render(image, glyphs):
	return '\n'.join((''.join((glyphs[v] for v in row)) for row in image))

def image2ascii(image):
	lut = generate_lut(255, len(GLYPHS) - 1)
	image = transform(image, lut)
	return render(image, GLYPHS)


GLYPHS = ' .,:;xyYX'

def image2ascii(image):
	maxValue = 255
	maxIndex = len(GLYPHS) - 1
	outStr = ''
	for row in image:
		for component in row:
			normalized = maxIndex * component // maxValue
			glyph = GLYPHS[normalized]
			outStr += glyph
		outStr += '\n'
	outStr = outStr[:-1]
	return outStr


glyphs = ' .,:;xyYX'

def image2ascii(image):
	ratio = 255 / 8
	new_rows = list()
	for row in image:
		new_row = ''.join((glyphs[int(pixel // ratio)] for pixel in row))
		new_rows.append(new_row)
	return '\n'.join(new_rows)


image2ascii = lambda m: '\n'.join([''.join([' .,:;xyYX'[8 * j // 255] for j in i]) for i in m])


image2ascii = lambda image: '\n'.join((''.join((' .,:;xyYX'[c * (len(' .,:;xyYX') - 1) // MAX] for c in line)) for line in image))


image2ascii = lambda i: '\n'.join((''.join((glyphs[c * (len(glyphs) - 1) // MAX] for c in r)) for r in i))


def image2ascii(image):
	glyphs = ' .,:;xyYX'
	conv = lambda c: glyphs[c * (len(glyphs) - 1) // 255]
	return '\n'.join([''.join([conv(c) for c in row]) for row in image])