{"id":26787471,"url":"https://github.com/controversial/image2ascii","last_synced_at":"2025-04-19T19:34:43.134Z","repository":{"id":32650978,"uuid":"36238129","full_name":"controversial/Image2ASCII","owner":"controversial","description":"Python application to convert images to ASCII art.","archived":false,"fork":false,"pushed_at":"2018-03-25T15:36:48.000Z","size":934,"stargazers_count":27,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T10:13:15.707Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/controversial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-25T15:18:08.000Z","updated_at":"2023-09-12T09:59:56.000Z","dependencies_parsed_at":"2022-07-12T15:40:35.371Z","dependency_job_id":null,"html_url":"https://github.com/controversial/Image2ASCII","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/controversial%2FImage2ASCII","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/controversial%2FImage2ASCII/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/controversial%2FImage2ASCII/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/controversial%2FImage2ASCII/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/controversial","download_url":"https://codeload.github.com/controversial/Image2ASCII/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249780550,"owners_count":21324573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-29T12:20:08.662Z","updated_at":"2025-04-19T19:34:43.117Z","avatar_url":"https://github.com/controversial.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image2ASCII\nPython application to convert images to ASCII art.\n\nThis is a python module that can convert any arbitrary image to ASCII art. It contains a module, `Image2ASCII.py`, that contains two functions.\n\n## Functions\n\n#### image2ASCII\nThe first function contained in `Image2ASCII.py` is `image2ASCII`. It can be used like `image2ASCII(im)` where im is a PIL image. For any image you provide, it does a few things.\n* Crop the image: the first real thing the function does is crop the image to be the largest possible square, which it centers in the top left.\n* Convert the image to black and white: for our use, we don't need the image to have multiple values with color. We only need it to have areas of brightness. We convert it to type 'L' for luminosity, that only has one value to work with.\n* Compress the image: We need the image to be a size so that one pixel corresponds to one character. We don't want it to be too big! By default, the image is 200 pixels wide\n* Strech the image: Fonts are typically taller than they are wide. When we print out ASCII art this way, it appears to be streched vertically. By squishing it down beforehand, it appears normal in text.\n* Actually generate the art: We iterate through the image, pixel by pixel, and decide on a character that would have appropriate 'visual weight'\nThen, the art is returned to you as a string with line breaks (`\\n`)\n\nThe function can also be used to show the starting image beforehand or generate art of a different size. In this case, you can use `image2ASCII(im, scale, showimage)`, where scale is an integer and showimage is a boolean value. \n\n##### Example\nThe image ![Circle](https://www.easycalculation.com/area/images/circle.gif), at a size of 20x20 looks like this:\n```\n                    \n      ,iv||/-       \n   ./i|=~_cvivc,    \n  /v/|c||c~v!~vi\\   \n c~==~\\/cc|/_civ~/  \n vv!vv|c=!v~~i|/_\\  \n |!|~icvc|/~==_v_!  \n  /_\\|/v/iv~~ii!!   \n   ,~i\\c__|~c~!,    \n      -=|\\vi.       \n```\n#### RenderASCII\nThe second function in `Image2ASCII.py` is `RenderASCII`. It can be used like `RenderASCII(text)`, where text is a string. The function is designed to render text from `image2ASCII` onto an image for easy viewing, without copy/pasting from the console. Rendering the text from the ball looks pretty much the same as the ball text pasted above. This same rendering method works quickly with big images.\n##### Example\n![Imgur](http://i.imgur.com/WWw63u4.jpg)\n\n## Example Script\n```\nfrom Image2ASCII import *\nimage = Image.open(\"Test_Images/Calvin.jpg\") #Open the image\nascii = image2ASCII(image)                   #Convert the image to ASCII\noutputimage = RenderASCII(ascii)             #Render the ASCII\noutputimage.show()                           #Show the final product\n```\nThis shows a rendered ASCII art image of the provided image of Calvin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontroversial%2Fimage2ascii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontroversial%2Fimage2ascii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontroversial%2Fimage2ascii/lists"}