MCPcopy Index your code
hub / github.com/geekcomputers/Python / main

Function main

meme_maker.py:17–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16
17def main():
18 path_to_image = sys.argv[1]
19 image_file = Image.open(path_to_image + ".jpg")
20 image_file = image_file.convert("RGBA")
21 pixdata = image_file.load()
22
23 print(image_file.size)
24 text, size, color_value = input_par()
25
26 # Font path is given as -->( " Path to your desired font " )
27 font = ImageFont.truetype("C:\\Windows\\Fonts\\Arial.ttf", size=size)
28
29 # If the color of the text is not equal to white,then change the background to be white
30 if (color_value[0] and color_value[1] and color_value[2]) != 255:
31 for y in range(100):
32 for x in range(100):
33 pixdata[x, y] = (255, 255, 255, 255)
34 # If the text color is white then the background is said to be black
35 else:
36 for y in range(100):
37 for x in range(100):
38 pixdata[x, y] = (0, 0, 0, 255)
39 image_file.show()
40
41 # Drawing text on the picture
42 draw = ImageDraw.Draw(image_file)
43 draw.text(
44 (0, 2300), text, (color_value[0], color_value[1], color_value[2]), font=font
45 )
46 draw = ImageDraw.Draw(image_file)
47
48 print("Enter the file name: ")
49 file_name = str(input())
50 image_file.save(file_name + ".jpg")
51 pass
52
53
54if __name__ == "__main__":

Callers 1

meme_maker.pyFile · 0.70

Calls 5

input_parFunction · 0.85
convertMethod · 0.80
loadMethod · 0.45
showMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected