{"id":13413198,"url":"https://github.com/qeesung/image2ascii","last_synced_at":"2025-05-14T23:04:49.821Z","repository":{"id":45318687,"uuid":"153871648","full_name":"qeesung/image2ascii","owner":"qeesung","description":":foggy: Convert image to ASCII","archived":false,"fork":false,"pushed_at":"2022-08-29T04:21:10.000Z","size":35888,"stargazers_count":911,"open_issues_count":9,"forks_count":79,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-13T19:49:57.792Z","etag":null,"topics":["ascii-art","ascii-image","convert-images","golang","image","image2ascii"],"latest_commit_sha":null,"homepage":"","language":"Go","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/qeesung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-20T05:06:25.000Z","updated_at":"2025-04-05T18:38:14.000Z","dependencies_parsed_at":"2022-08-12T11:51:33.908Z","dependency_job_id":null,"html_url":"https://github.com/qeesung/image2ascii","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qeesung%2Fimage2ascii","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qeesung%2Fimage2ascii/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qeesung%2Fimage2ascii/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qeesung%2Fimage2ascii/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qeesung","download_url":"https://codeload.github.com/qeesung/image2ascii/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243358,"owners_count":22038046,"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":["ascii-art","ascii-image","convert-images","golang","image","image2ascii"],"created_at":"2024-07-30T20:01:34.971Z","updated_at":"2025-05-14T23:04:44.795Z","avatar_url":"https://github.com/qeesung.png","language":"Go","funding_links":[],"categories":["Images","Images 图像处理","图片","Go","Relational Databases","Generators \u0026 Converters"],"sub_categories":["Search and Analytic Databases","SQL 查询语句构建库","检索及分析资料库","Advanced Console UIs","Imported: Upstream Snippet Gallery"],"readme":"# :foggy: Image2ascii\n\n[![Build Status](https://travis-ci.org/qeesung/image2ascii.svg?branch=master)](https://travis-ci.org/qeesung/image2ascii)\n[![Coverage Status](https://coveralls.io/repos/github/qeesung/image2ascii/badge.svg?branch=master)](https://coveralls.io/github/qeesung/image2ascii?branch=master)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/71a3059b49274dde9d81d58cedd80962)](https://app.codacy.com/app/qeesung/image2ascii?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=qeesung/image2ascii\u0026utm_campaign=Badge_Grade_Dashboard)\n[![Go Report Card](https://goreportcard.com/badge/github.com/qeesung/image2ascii)](https://goreportcard.com/report/github.com/qeesung/image2ascii)\n[![GoDoc](https://godoc.org/github.com/qeesung/image2ascii?status.svg)](https://godoc.org/github.com/qeesung/image2ascii)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)\n\nImage2ASCII is a library that converts images into ASCII images and provides command-line tools for easy use.\n\n![demo](https://github.com/qeesung/image2ascii/blob/master/docs/images/lufei.gif?raw=true)\n\n## Installation\n\n```bash\ngo install github.com/qeesung/image2ascii@latest\n```\n\n## CLI usage\n\n```bash\nimage2ascii version: image2ascii/1.0.0\n\u003e\u003e HomePage: https://github.com/qeesung/image2ascii\n\u003e\u003e Issue   : https://github.com/qeesung/image2ascii/issues\n\u003e\u003e Author  : qeesung\nUsage: image2ascii [-s] -f \u003cfilename\u003e -r \u003cratio\u003e -w \u003cwidth\u003e -g \u003cheight\u003e\n\nOptions:\n  -c    Colored the ascii when output to the terminal (default true)\n  -f string\n        Image filename to be convert (default \"docs/images/lufei.jpg\")\n  -g int\n        Expected image height, -1 for image default height (default -1)\n  -i    Reversed the ascii when output to the terminal\n  -r float\n        Ratio to scale the image, ignored when use -w or -g (default 1)\n  -s    Fit the terminal screen, ignored when use -w, -g, -r (default true)\n  -t    Stretch the picture to overspread the screen\n  -w int\n        Expected image width, -1 for image default width (default -1)\n```\n\nconvert the image fit the screen(default is true)\n```bash\nimage2ascii -f docs/images/pikaqiu2.jpg\n```\n![demo](https://github.com/qeesung/image2ascii/blob/master/docs/images/pikaqiu_s.gif?raw=true)\n\nconvert the image to ascii image with fixed width and height\n```bash\n# width: 100\n# height: 30\nimage2ascii -f docs/images/baozou.jpg -w 100 -g 30\n```\n![demo](https://github.com/qeesung/image2ascii/blob/master/docs/images/baozou.gif?raw=true)\n\nconvert the image to ascii image by ratio\n```bash\n# ratio: 0.3\n# width: imageWidth * 0.3\n# height: imageHeight * 0.3\nimage2ascii -f docs/images/pikaqiu.jpg -r 0.3\n```\n![demo](https://github.com/qeesung/image2ascii/blob/master/docs/images/pikaqiu.gif?raw=true)\n\nconvert the image to stretch the screen\n```bash\nimage2ascii -f docs/images/long.jpg -t\n```\n![demo](https://github.com/qeesung/image2ascii/blob/master/docs/images/long.gif?raw=true)\n\nconvert the image without the color\n```bash\nimage2ascii -f docs/images/lufei.jpg -s -c=false\n```\n\nconvert the image disable fit the screen\n```bash\nimage2ascii -f docs/images/lufei.jpg -s=false\n```\n\nconvert the image reverse the chars\n```bash\nimage2ascii -f docs/images/lufei.jpg -i\n```\n\n## Library usage\n\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/qeesung/image2ascii/convert\"\n\t_ \"image/jpeg\"\n\t_ \"image/png\"\n)\n\nfunc main() {\n\t// Create convert options\n\tconvertOptions := convert.DefaultOptions\n\tconvertOptions.FixedWidth = 100\n\tconvertOptions.FixedHeight = 40\n\n\t// Create the image converter\n\tconverter := convert.NewImageConverter()\n\tfmt.Print(converter.ImageFile2ASCIIString(imageFilename, \u0026convertOptions))\n}\n```\n\nconvert options\n\n```golang\ntype Options struct {\n\tRatio           float64 // convert ratio\n\tFixedWidth      int  // convert the image width fixed width\n\tFixedHeight     int  // convert the image width fixed height\n\tFitScreen       bool // only work on terminal, fit the terminal height or width\n\tStretchedScreen bool // only work on terminal, stretch the width and heigh to overspread the terminal screen\n\tColored         bool // only work on terminal, output ascii with color\n\tReversed        bool // if reverse the ascii pixels\n}\n```\n\nsupported convert function\n```golang\ntype Converter interface {\n\t// convert a image object to ascii matrix\n\tImage2ASCIIMatrix(image image.Image, imageConvertOptions *Options) []string\n\t// convert a image object to ascii matrix and then join the matrix to a string\n\tImage2ASCIIString(image image.Image, options *Options) string\n\t// convert a image object by input a string to ascii matrix\n\tImageFile2ASCIIMatrix(imageFilename string, option *Options) []string\n\t// convert a image object by input a string to ascii matrix then join the matrix to a string\n\tImageFile2ASCIIString(imageFilename string, option *Options) string\n}\n```\n\n## Sample outputs\n\n| Raw Image                                                                                     | ASCII Image                                                                                              |\n|:---------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------:|\n| ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/lufei.jpg)      | ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/lufei_ascii.png)           |\n| ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/lufei.jpg)      | ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/lufei_ascii_colored.png)   |\n| ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/pikaqiu.jpeg)   | ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/pikaqiu_ascii.png)         |\n| ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/pikaqiu.jpeg)   | ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/pikaqiu_ascii_colored.png) |\n| ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/baozou.jpg)     | ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/baozou_ascii.png)          |\n| ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/baozou.jpg)     | ![](https://raw.githubusercontent.com/qeesung/image2ascii/master/docs/images/baozou_ascii_colored.png)  |\n\n## License\n\nThis project is under the MIT License. See the [LICENSE](https://github.com/qeesung/image2ascii/blob/master/LICENSE) file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqeesung%2Fimage2ascii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqeesung%2Fimage2ascii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqeesung%2Fimage2ascii/lists"}