def imgtotxt(): pywhatkit.image_to_ascii_art( "/Users/mac/OneDrive/Programming/webapp/Todo/img/firetech_logo.png", "/Users/mac/OneDrive/Programming/webapp/Todo/img/firetech_logo.txt") f = open( '/Users/mac/OneDrive/Programming/webapp/Todo/img/firetech_logo.txt', 'r') lines = f.read() f.close() return render_template("Text Image display.html", asciiImage=lines)
def convert(): try: import pywhatkit as kit if len(filename) != 0: if save.get() != "": kit.image_to_ascii_art(filename, "{}.txt".format(save.get())) lab_success.config( text="Image converted to ascii successfully") else: tkinter.messagebox.showerror("Error", "Please Enter Save Name") else: tkinter.messagebox.showerror("Error", "Please Select Image") except Exception as e: tkinter.messagebox.showerror("Error", e)
import pywhatkit # variables image = input("Enter the name of Image file (with extension): ") text = input("Enter the name for Art file (recommended in txt extension): ") # main code pywhatkit.image_to_ascii_art(image, text)
import pywhatkit print("\n") # text = "Doctor Strange is a 2016 American superhero film based on the Marvel Comics character of the same name." # pywhatkit.sendwhatmsg("+918857819957","This is a message",15,00) # pywhatkit.info("Python",lines=3) pywhatkit.image_to_ascii_art("python.jpg", "python.txt") # pywhatkit.text_to_handwriting(text,rgb=[0,0,0]) # pywhatkit.check_window() # pywhatkit.help.search() # pywhatkit.showHistory()
# -*- coding: utf-8 -*- """ Created on Sat Jan 16 20:57:38 2021 @author: DELL """ #importing package import pywhatkit as pkt #displaying a message print("Turning to Images To ASCII Art") #path to the image - here in same folder as of the current project file source_path = 'star.png' #path to store the output, as it is an ASCII file, saving it with .text extension target_path = 'ascii_art.text' #calling the inbuilt method of the module which converts the image to ASCII art, image_to_ascii_art(source_path,target_path) #by default the location of the ascii art image will be the same pkt.image_to_ascii_art(source_path, target_path)
import pywhatkit as kit kit.image_to_ascii_art('../../assets/img/python-logo.png') # Will be created pywhatkit_asciiart.txt
""" Image To Ascii Art Generator - Generates an ascii art of the image provided and writes it to a text file. Author : Rudransh Joshi (GitHub: FireHead90544) Date : 10th Oct. 2021 """ import pywhatkit # pip install pywhatkit import os imgPath = input("Enter path to the image: ") if os.path.exists(imgPath): pywhatkit.image_to_ascii_art(imgPath, 'output.txt') else: print("Invalid path to image.")
# install pywhatkit using pip install pywhatkit import pywhatkit as pwk path_to_image = "" # Example path "C:/Users/user_name/Downloads/1.jpg" output_file = "" # Example path "C:/Users/user_name/Downloads/1.txt" pwk.image_to_ascii_art(path_to_image, output_file)
import pywhatkit as kit kit.image_to_ascii_art(r"C:\Users\suaImagem.jpg")
import pywhatkit as kt img = "image.jpg" text = "text" kt.image_to_ascii_art(img, text)
import pywhatkit pywhatkit.image_to_ascii_art('download.jpg', output_file='user_art.txt') print("converted")
from pywhatkit import image_to_ascii_art # Caminho da imagem entrada_img = 'python.png' # Caminho da saida saida_arquivo_txt = 'ascii_python.txt' # Esta função cria um arquivo e é possível imprimir a arte print(image_to_ascii_art(imgpath=entrada_img, output_file=saida_arquivo_txt))
#Convert Image Into ASCII Art import pywhatkit pywhatkit.image_to_ascii_art("img path", "converted txt path") # Watch the tutorial of this code on my youtube channel # Here - https://www.youtube.com/channel/UCmOBuijDvNgUMlqpzrwEBcw
''' Turn any images to ASCII art using Python Author: Ayushi Rawat ''' #import the necessary module! import pywhatkit as kt #display welcome msg print("Let's turn images to ASCII art!") #capture source and target path source_path = 'flower.png' target_path = 'demo_ascii_art2.text' #target_path = 'demo_ascii_art.text' #call the method kt.image_to_ascii_art(source_path, target_path) -------------------------------------------------------------- #2 lines of code import pywhatkit as kt kt.image_to_ascii_art('flower.png', 'demo_ascii_art2.text')
import pywhatkit pywhatkit.image_to_ascii_art('#demo.png', '#demo.txt')
from pywhatkit import image_to_ascii_art import os x = 0 while x == 0: image= input('image path: ') if os.path.exists(image): x = 1 else: print('No such file or dir !! Try agin') text = 'art.txt' image_to_ascii_art(image, text) file = open('art.txt', 'r') x = file.read() print(x)
def convert_to_ascii(self): self.convert_btn.config(state=tk.DISABLED) filename = 'ascii.txt' pywhatkit.image_to_ascii_art(self.filepath.get(), filename) os.startfile(filename) self.convert_btn.config(state=tk.NORMAL)
#pip install pywhatkit import pywhatkit pywhatkit.image_to_ascii_art("carry_1.png", "carry3.txt") #image file name,txt file name
import pywhatkit pywhatkit.image_to_ascii_art('a.jpg', 'ni.txt')
import pywhatkit pywhatkit.image_to_ascii_art("me.jpg", "me.txt")
from tkinter import filedialog import pywhatkit as kit from tkinter import * from tkinter import ttk # Root Tkinter root = tk.Tk() root.withdraw() # File name extensions files = [('Images', '*.*'), ('PNG File', '*.png'), ('JPEG File', '*.jpeg'), ('GIF File', '*.gif'), ('JPG File', '*.jpg'), ('Bitmap File', '*.bmp')] sfiles = [('Text Document', '*.txt')] # Mian prints print("\nOnly choose a Image File Format\n") print("\nPlease create a text document before. Or it will show an error\n") # The file path save_file_path = filedialog.askopenfilename(initialdir="/", title="Select a File", filetypes=sfiles) file_path = filedialog.askopenfilename(initialdir="/", title="Select a File", filetypes=files) kit.image_to_ascii_art(file_path, save_file_path) input("\npress Enter key to exit\n")
import pywhatkit pywhatkit.image_to_ascii_art( 'flo.jpg', 'flo.text')
''' Convert any images to ASCII art using Python ''' #import the necessary module! import pywhatkit as kt print("Let's convert images to ASCII art!") #Input source path print("Enter file name to convert") source_path = input() #target_path target_path = 'asciify.text' #call the method kt.image_to_ascii_art(source_path, target_path) #2 lines of code import pywhatkit as kt kt.image_to_ascii_art('source_path', 'target_path')
def run_google(): command = take_command() print(command) if 'joke' in command: joke = pyjokes.get_joke() print(joke) talk(joke) elif 'your name' in command: talk('my name is google assistant. I\'m created by md jawad hossain') print('my name is google assistant. I\'m created by md jawad hossain') elif 'create you' in command: talk('I\'m created by md jawad hossain') print('I\'m created by md jawad hossain') elif 'site' in command: print('which site you want to go?') talk('which site you want to go?') site = take_command() print('opening', site) talk('opening') talk(site) webbrowser.open('https://'+site) elif 'image to text' in command: print('whom image you want to create image to text') talk('whom image you want to create image to text') iname = take_command() print(iname) talk('creating Image to text') print('creating', iname, 'Image to text') link = { 'jawad': 'jawad.png', 'javed': 'jawad.png', 'java 8': 'jawad.png', 'jaat': 'jawad.png', 'riyan': 'riyan.png', 'ramayan': 'riyan.png', 'tanvir': 'riyan.png', 'pahad': 'forhad.png', 'fahad': 'forhad.png', 'forhad': 'forhad.png', 'forehead': 'forhad.png', 'download': 'download.png' } lin = link[iname] pywhatkit.image_to_ascii_art(lin, iname+'.txt') sleep(1) print('The image has been created successfully.\n you can see it from:::\nfile:///C:/Users/Md%20Jawad%20Hossain/PycharmProjects/chatbot2/'+iname+'.txt', '\nthis location.') talk('The image has been created successfully.you can see it from this location.') elif 'send' in command: def sent_email(receiver, subject, body): server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(gmail, password) email = EmailMessage() email['From'] = gmail email['To'] = receiver email['Subject'] = subject email.set_content(body) server.send_message(email) email_list = { 'jawad': '*****@*****.**', 'sath': '*****@*****.**', 'aahat': '*****@*****.**', 'jorhat': '*****@*****.**', 'java 8': '*****@*****.**', 'javed': '*****@*****.**', 'chat': '*****@*****.**', 'jaat': '*****@*****.**', 'tanvir': '*****@*****.**', 'riyan': '*****@*****.**', 'tuhin': '*****@*****.**', 'forhad': '*****@*****.**', 'south': '*****@*****.**' } def get_email_info(): print('to whom you want to send email?') talk('to whom you want to send email?') name = take_command() print(name) receiver = email_list[name] print(receiver) print('What is the subject in your email?') talk('What is the subject in your email?') subject = take_command() print(subject) print('what do you want to send?') talk('what do you want to send?') body = take_command() print(body) print('Is that correct?') print('\n\nFrom :',gmail,' \n', 'To :', receiver, '\n Subject: ', subject, '\nBody :', body, '\n\n' ) talk('Is that correct?') correct = take_command() if 'yes' in correct: sent_email(receiver, subject, body) print('Hey jawad . Your email is successfully sent to him') talk('Hey jawad . Your email is successfully sent to him') print('Do you want to send more email?') talk('Do you want to send more email?') send_more = take_command() if 'yes' in send_more: get_email_info() if 'no' in send_more: print('Ok. I ll be there when you call me ') talk('Ok. I ll be there when you call me.') if 'no' in correct: print('ok. I don\'t send the the email.') talk('ok. I don\'t send the the email.') print('Do you want to send email again to anyone?') talk('Do you want to send email again to anyone?') send_more = take_command() if 'yes' in send_more: get_email_info() if 'no' in send_more: print('Okey') talk('Okey') get_email_info() elif 'you do' in command: talk('I\'m doing anything for you.') print('I\'m doing anything for you.') elif 'thank you' in command: talk('you\'re most welcome') print('you\'re most welcome') elif 'how are' in command: talk('im feeling happy when you talk to me. by the way, and you?') print('im feeling happy when you talk to me.by the way, and you?') elif 'how about you ' in command: talk('im feeling happy when you talk to me. by the way, and you?') print('im feeling happy when you talk to me.by the way, and you?') elif 'thanks' in command: talk('you\'re most welcome') print('you\'re most welcome') elif 'siri' in command: talk('Siri is a virtual assistant that is part of Apple Inc. .she is very intelligent like me!') print('Siri is a virtual assistant that is part of Apple Inc. .she is very intelligent like me!') elif 'ok' in command: talk(' ') print(' ') elif 'fine' in command: talk(' ') print(' ') elif 'weather' in command: pyautogui.hotkey('win', 's') pyautogui.typewrite(command) pyautogui.press('enter') elif 'play' in command: song = command.replace('play', '') talk('playing' + song) pywhatkit.playonyt(song) elif 'the time' in command: time = datetime.datetime.now().strftime('%I:%M %p') print(time) talk('Current time is ' + time) elif 'who' in command: person = command.replace('who', '') info = wikipedia.summary(person, 1) print(info) talk(info) elif 'what' in command: perso = command.replace('what', '') inf = wikipedia.summary(perso, 1) print(inf) talk(inf) elif 'date' in command: talk('sorry, I have a headache') print('sorry, I have a headache') elif 'you single' in command: talk('I am in a relationship with wifi') print('I am in a relationship with wifi') elif 'open' in command: a = command.replace('open', '') print('opening', a) talk('opening') pyautogui.hotkey('win', 's') pyautogui.typewrite(a) pyautogui.press('enter') elif 'your name' in command: talk('my name is google assistant. I\'m created by md jawad hossain') print('I am in a relationship with wifi') else: print('I find it to google') talk('I find it to google') webbrowser.open('https://www.google.com/search?q=' + command)
import pywhatkit pywhatkit.image_to_ascii_art('img.png','img.txt') # pywhatkit.sendwhatmsg("+91YOUR NUMBERS ","This is a message",22,5) #later you have to tell time in hours in 24 hour format and minutes # This will play the first video that appears upon searching "Python" on YouTube # pywhatkit.playonyt("Python") # This will perform a Google search about Python # pywhatkit.search("Python") # pywhatkit.showHistory()#Will show information of all the messages sent using this library # pywhatkit.shutdown(time=100)#Will shutdown the system in 100 seconds # pywhatkit.cancelShutdown()#Will cancel the scheduled shutdown # pywhatkit.watch_tutorial_in_english/hindi()#Will open a tutorial on how to use this library on YouTube in respective language # pywhatkit.help() #For more information
import pywhatkit imageReceiver = input( 'nome e tipo do arquivo a ser transformado (arquivo.jpg): ') imr = imageReceiver result = imr.split('.') result = 'results/%s.txt' % (result[0]) imageReceiver = 'images/' + imageReceiver pywhatkit.image_to_ascii_art(imageReceiver, result) # resultado do path os esta a imagem original e a convertida em txt print('--------------------------------------------') print('--------------------------------------------') print(imageReceiver) print('--------------------------------------------') print('--------------------------------------------') print(result)
import pywhatkit pywhatkit.image_to_ascii_art("trishul.jpg", "trishul.txt")
import pywhatkit pywhatkit.image_to_ascii_art("demo2.jpg", "s.txt")
from pywhatkit import image_to_ascii_art entrada = 'python.png' saida_image = 'ascii_python.txt' print(image_to_ascii_art(imgpath=entrada, output_file=saida_image))
import pywhatkit pywhatkit.image_to_ascii_art('ck.png','ck.txt')