Skip to content

Commit

Permalink
Colors are changed
Browse files Browse the repository at this point in the history
If the text color and bg color is same,then the text will not be visible
So I added few lines to ensure that they remain different.
  • Loading branch information
GauthamramRavichandran committed Sep 8, 2017
1 parent 2f5c407 commit e86711b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions meme_maker.py
Expand Up @@ -6,7 +6,7 @@
def input_par():
print('Enter the text to insert in image: ')
text = str(input())
print('Enter the desired size: ')
print('Enter the desired size of the text: ')
size = int(input())
print('Enter the color for the text(r, g, b): ')
color_value = [int(i) for i in input().split(' ')]
Expand All @@ -22,14 +22,20 @@ def main():

print(image_file.size)
text, size, color_value = input_par()


#Font path is given as -->( " Path to your desired font " )
font = ImageFont.truetype("C:\\Windows\\Fonts\\Arial.ttf", size=size)

# Clean the background noise, if color != white, then set to black.
# change with your color
for y in range(100):
for x in range(100):
pixdata[x, y] = (255, 255, 255, 255)
#If the color of the text is not equal to white,then change the background to be white
if((color_value[0] and color_value[1] and color_value[2])!=255):
for y in range(100):
for x in range(100):
pixdata[x, y] = (255, 255, 255, 255)
#If the text color is white then the background is said to be black
else:
for y in range(100):
for x in range(100):
pixdata[x, y] = (0,0, 0, 255)
image_file.show()

# Drawing text on the picture
Expand Down

0 comments on commit e86711b

Please sign in to comment.