-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
59 lines (46 loc) · 1.64 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import imageio as imio
import Ascii
import VideoAscii
from AsciiDico import GetDico, Tryimg, GetDicoImg, GetAnotherDico, GetFinal
import AsciiDico
from PIL import Image, ImageFont, ImageDraw
import numpy as np
import os
import os
project_Path = os.path.dirname(__file__) + '/'
print(project_Path)
def ConvertVideo(infile, outfile, fontfile) :
video = imio.get_reader(infile)
VideoAscii.VideoToAscii(video,
300,
project_Path + r"./Temp/",
outfile,
True, 10, 2,
fontfile,
(30, 30, 30))
ConvertVideo(project_Path + r"Videos/Logo_EPITA.mp4",
project_Path + r"Videos/Logo_EPITA remake.mp4",
project_Path + r"./RobotoMono-Regular.ttf")
"""
(width, height) = (1920, 1080)
(lines, cols) = 90, 321
scale = 10##int(height/lines - 5)
print(scale)
img = np.zeros((height, width, 3), np.uint8)
image = VideoAscii.GetAPillowImage(r"images/img 153.txt", scale, project_Path + r"RobotoMono-Regular.ttf", (255, 255, 255), img)
#image = VideoAscii.GetAPillowImage(r"img 153.txt", scale, r".\RobotoMono-Regular.ttf", (255, 255, 255), img)
Image.fromarray(image).show()
# img = Ascii.ToAscii(img, 200, r".\..\Image 52bk.txt", False, 5, 1)
imio.imwrite(r"test.png", image)
"""
"""
def GetBackGround2(width, height, color):
img = np.zeros((width, height, 3), np.uint8)
img = Image.fromarray(img)
test = img.load()
for i in range(width) :
for j in range(height) :
test[i, j] = color
img.save(r".\..\Image 99bk2.png")
color = (69, 42, 7)
GetBackGround2(1000, 1000, color)"""