Skip to content

Ascii Art

SigireddyBalasai edited this page Dec 4, 2022 · 4 revisions
image_to_ascii_art(img_path: str, output_file: str = "pywhatkit_asciiart") -> str

This is used to convert an Image to an ASCII Art form that is stored in a text file.
If the image that you want to convert is stored in the same directory where the python file is stored you can just pass the name of the file. If it is in another directory then you need to give the full Path to the file.

Same Directory:

await AsyncPywhatKit.image_to_ascii_art("Example.png")

Different Directory:

await AsyncPywhatKit.image_to_ascii_art("C:\\Example\\Example.png")

By default, the output is stored in pywhatkit_asciiart.txt, but you can change the output filename with

import asyncio
import AsyncPywhatKit
async def main():
    image = await AsyncPywhatKit.image_to_ascii_art("Example.png", "filename")
    print(image)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Clone this wiki locally