We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4109ed0 commit c775d3eCopy full SHA for c775d3e
Photo To Ascii/photo_to_ascii.py
@@ -22,7 +22,17 @@ def photoascii():
22
except Exception:
23
print("Invalid path")
24
return
25
-
+ #Fetching the name of the image
26
+ image_name=""
27
+ flag=0
28
+ for i in path[::-1]:
29
+ if i=="/":
30
+ break
31
+ if flag==1:
32
+ image_name=i+image_name
33
+ if i=='.':
34
+ flag=1
35
+
36
#Resizing of image
37
new_width=100
38
width, height = image.size
@@ -38,7 +48,7 @@ def photoascii():
48
39
49
40
50
# save result to "ascii_image.txt"
41
- with open("./Photo To Ascii/ascii_image.txt", "w") as f:
51
+ with open("./Photo To Ascii/{}(ASCII).txt".format(image_name), "w") as f:
42
52
f.write(ascii_image)
43
53
# run program
44
54
if __name__=='__main__':
0 commit comments