All Projects → qeesung → Image2ascii

qeesung / Image2ascii

Licence: mit
🌁 Convert image to ASCII

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Image2ascii

Asciipy
translate images, videos and text to Ascii arts easy
Stars: ✭ 52 (-89.68%)
Mutual labels:  image, ascii-art
Compressor
An easy to use and well designed image compress library for Android, based on Android native image library. Put forward a framework for quick switch from different compress algorithm.
Stars: ✭ 476 (-5.56%)
Mutual labels:  image
React Native Blurhash
🖼️ A library to show colorful blurry placeholders while your content loads.
Stars: ✭ 430 (-14.68%)
Mutual labels:  image
Amplify
A tiny script allowing inline image zoom
Stars: ✭ 458 (-9.13%)
Mutual labels:  image
Ftxui
💻 C++ Functional Terminal User Interface. ❤️
Stars: ✭ 433 (-14.09%)
Mutual labels:  ascii-art
Hjcornerradius
A category for UIImageView with support for cornerRadius automatically
Stars: ✭ 469 (-6.94%)
Mutual labels:  image
Imgcat
a tool to output images as RGB ANSI graphics on the terminal
Stars: ✭ 425 (-15.67%)
Mutual labels:  image
React Viewer
react image viewer, supports rotation, scale, zoom and so on
Stars: ✭ 502 (-0.4%)
Mutual labels:  image
Synthesizing
Code for paper "Synthesizing the preferred inputs for neurons in neural networks via deep generator networks"
Stars: ✭ 474 (-5.95%)
Mutual labels:  image
Myvision
Computer vision based ML training data generation tool 🚀
Stars: ✭ 453 (-10.12%)
Mutual labels:  image
Weir
A system for making generative systems
Stars: ✭ 451 (-10.52%)
Mutual labels:  image
Wasm Imagemagick
Webassembly compilation of https://github.com/ImageMagick/ImageMagick & samples
Stars: ✭ 442 (-12.3%)
Mutual labels:  image
Zmjimageeditor
ZMJImageEditor is a picture editing component like WeChat. It is powerful and easy to integrate, supporting rendering, text, rotation, tailoring, mapping and other functions. (ZMJImageEditor 是一个和微信一样图片编辑的组件,功能强大,极易集成,支持绘制、文字、旋转、剪裁、贴图等功能)
Stars: ✭ 470 (-6.75%)
Mutual labels:  image
Ascii Art
A Node.js library for ansi codes, figlet fonts, ascii art and other ASCII graphics
Stars: ✭ 437 (-13.29%)
Mutual labels:  ascii-art
Retinajs
JavaScript, SCSS, Sass, Less, and Stylus helpers for rendering high-resolution image variants
Stars: ✭ 4,470 (+786.9%)
Mutual labels:  image
Fmphotopicker
A modern, simple and zero-dependency photo picker with an elegant and customizable image editor
Stars: ✭ 428 (-15.08%)
Mutual labels:  image
Exifr
EXIF Reader
Stars: ✭ 450 (-10.71%)
Mutual labels:  image
Imgproxy
Fast and secure standalone server for resizing and converting remote images
Stars: ✭ 5,688 (+1028.57%)
Mutual labels:  image
Search By Image
Browser extension for reverse image search, available for Edge, Chrome and Firefox
Stars: ✭ 500 (-0.79%)
Mutual labels:  image
Renderhelp
⚡️ 可编程渲染管线实现,帮助初学者学习渲染
Stars: ✭ 494 (-1.98%)
Mutual labels:  image

🌁 Image2ascii

Build Status Coverage Status Codacy Badge Go Report Card GoDoc License: MIT Awesome

Image2ASCII is a library that converts images into ASCII images and provides command-line tools for easy use.

demo

Installation

go get github.com/qeesung/image2ascii

CLI usage

image2ascii version: image2ascii/1.0.0
>> HomePage: https://github.com/qeesung/image2ascii
>> Issue   : https://github.com/qeesung/image2ascii/issues
>> Author  : qeesung
Usage: image2ascii [-s] -f <filename> -r <ratio> -w <width> -g <height>

Options:
  -c    Colored the ascii when output to the terminal (default true)
  -f string
        Image filename to be convert (default "docs/images/lufei.jpg")
  -g int
        Expected image height, -1 for image default height (default -1)
  -i    Reversed the ascii when output to the terminal
  -r float
        Ratio to scale the image, ignored when use -w or -g (default 1)
  -s    Fit the terminal screen, ignored when use -w, -g, -r (default true)
  -t    Stretch the picture to overspread the screen
  -w int
        Expected image width, -1 for image default width (default -1)

convert the image fit the screen(default is true)

image2ascii -f docs/images/pikaqiu2.jpg

demo

convert the image to ascii image with fixed width and height

# width: 100
# height: 30
image2ascii -f docs/images/baozou.jpg -w 100 -g 30

demo

convert the image to ascii image by ratio

# ratio: 0.3
# width: imageWidth * 0.3
# height: imageHeight * 0.3
image2ascii -f docs/images/pikaqiu.jpg -r 0.3

demo

convert the image to stretch the screen

image2ascii -f docs/images/long.jpg -t

demo

convert the image without the color

image2ascii -f docs/images/lufei.jpg -s -c=false

convert the image disable fit the screen

image2ascii -f docs/images/lufei.jpg -s=false

convert the image reverse the chars

image2ascii -f docs/images/lufei.jpg -i

Library usage

package main

import (
	"fmt"
	"github.com/qeesung/image2ascii/convert"
	_ "image/jpeg"
	_ "image/png"
)

func main() {
	// Create convert options
	convertOptions := convert.DefaultOptions
	convertOptions.FixedWidth = 100
	convertOptions.FixedHeight = 40

	// Create the image converter
	converter := convert.NewImageConverter()
	fmt.Print(converter.ImageFile2ASCIIString(imageFilename, &convertOptions))
}

convert options

type Options struct {
	Ratio           float64 // convert ratio
	FixedWidth      int  // convert the image width fixed width
	FixedHeight     int  // convert the image width fixed height
	FitScreen       bool // only work on terminal, fit the terminal height or width
	StretchedScreen bool // only work on terminal, stretch the width and heigh to overspread the terminal screen
	Colored         bool // only work on terminal, output ascii with color
	Reversed        bool // if reverse the ascii pixels
}

supported convert function

type Converter interface {
	// convert a image object to ascii matrix
	Image2ASCIIMatrix(image image.Image, imageConvertOptions *Options) []string
	// convert a image object to ascii matrix and then join the matrix to a string
	Image2ASCIIString(image image.Image, options *Options) string
	// convert a image object by input a string to ascii matrix
	ImageFile2ASCIIMatrix(imageFilename string, option *Options) []string
	// convert a image object by input a string to ascii matrix then join the matrix to a string
	ImageFile2ASCIIString(imageFilename string, option *Options) string
}

Sample outputs

Raw Image ASCII Image

License

This project is under the MIT License. See the LICENSE file for the full license text.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].