How do you make this?

How do you make this?

Other urls found in this thread:

phpsecure.info/gifanimscii.php
twitter.com/SFWRedditGifs

>>>>>>>>>>>>>

by using hard work, dedication and meme magic

pacman -S cowsay

cowsay 'nigger'

...

It's an autism thing

you don't "make" meme magic it just flows through the internet

here's a quick example

from PIL import Image, ImageDraw, ImageFont

charset = "^_`abcdefghijklmnopqrstuvwxyz~*+-.:{}0123456789?@ABCDEFGHIJKLMNOPQRSTUVWXYZ#$%&"
font_size = 18

font = ImageFont.truetype("Consolas.ttf", size=18)
char_w, char_h = font.getsize("#")

ima = Image.open("pepe.png")
imb = Image.new("RGB", ima.size, (0, 0, 0))
ima = ima.resize((ima.size[0] / char_w, ima.size[1] / char_h))
dc = ImageDraw.Draw(imb)

for y in range(ima.size[1]):
for x in range(ima.size[0]):
r, g, b = ima.getpixel((x, y))[:3]
r = int(r / 6) * 6
g = int(g / 6) * 6
b = int(b / 6) * 6
n = (r + g + b) / (255.0 * 3)
ch = charset[int((len(charset) - 1) * n)]
dc.text((x * char_w, y * char_h), ch, fill=(r, g, b), font=font)

imb.format = "PNG"
imb.save("pepe2.png")

>imb.format = "PNG"

amazing API

you can pass it to the save method directly to make it look less retarded, as I've just found out

I guess it's mainly there to determine the format when you open an image, not the other way around

just use libcaca

>r = int(r / 6) * 6
Why?

To get that authentic 216-color feel (6-6-6 RGB).

One could also include 24 grayscale values to reach xterm's 240 colors.

>python is shit
>you cant do anything with it

how about gif

nvm i managed to do it

rarest pepe

aalib

Thank you!

can you share the code?

not code upload your gif to here
phpsecure.info/gifanimscii.php

:^]

this is fun

dumb frogposter

...

There are many things you can do with Python, but it doesn't make Python less shit.

cleaned it a little and added gif support
from PIL import Image, ImageDraw, ImageFont, ImageSequence
import sys

charset = "^_`abcdefghijklmnopqrstuvwxyz~*+-.:{}0123456789?@ABCDEFGHIJKLMNOPQRSTUVWXYZ#$%&"
font_size = 10

font = ImageFont.truetype("Consolas.ttf", size=font_size)
char_w, char_h = font.getsize("W")

def process_image(im):
size = im.size
im = im.convert("RGB")
im = im.resize((im.size[0] / char_w, im.size[1] / char_h))
out_im = Image.new("RGB", size, (0, 0, 0))
dc = ImageDraw.Draw(out_im)
for y in range(im.size[1]):
for x in range(im.size[0]):
r, g, b = im.getpixel((x, y))
r = int(r / 6) * 6
g = int(g / 6) * 6
b = int(b / 6) * 6
n = (r + g + b) / (255.0 * 3)
ch = charset[int((len(charset) - 1) * n)]
dc.text((x * char_w, y * char_h), ch, fill=(r, g, b), font=font)
return out_im

def main():
try:
filename = sys.argv[1]
out_filename = sys.argv[2]
except IndexError:
print "Usage: %s " % sys.argv[0]
return
im = Image.open(filename)
if im.format == "GIF":
frames = []
for frame in ImageSequence.Iterator(im):
frame = process_image(frame)
frames.append(frame)
frames[0].save(out_filename, format=im.format,
save_all=True, append_images=frames[1:],
loop=im.info["loop"], duration=im.info["duration"])
else:
pim = process_image(im)
pim.save(out_filename, format=im.format)
im.close()

if __name__ == "__main__":
main()

noice