image2ascii

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2018 License: MIT Imports: 6 Imported by: 0

README

🌁image2ascii

Build Status

Convert image to ASCII

installation

go get https://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
  -g int
        Expected image height, -1 for image default height (default -1)
  -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)
  -w int
        Expected image width, -1 for image default width (default -1)

convert the image to ascii image with fixed width and height

# width: 100
# height: 30
image2ascii -f example/images/lufei.jpg -w 100 -g 30

convert the image to ascii image by ratio

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

convert the image to ascii fit the screen

image2ascii -f example/images/lufei.jpg -s

convert the image without the color

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

convert the image disable fit the screen

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

library usage

package main

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

func main() {
	fmt.Print(convert.ImageFile2ASCIIString("example/images/baozou.jpg", &convert.Options{
		Ratio: 0.5,
	}))
}

example outputs

Raw Image ASCII Image

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
The ascii package can convert a image pixel to a raw char base on it's RGBA value, in another word, input a image pixel output a raw char ascii.
The ascii package can convert a image pixel to a raw char base on it's RGBA value, in another word, input a image pixel output a raw char ascii.
The convert package convert a image to ascii string or matrix The resize package resize the image to expected size base on the ratio, for the most matched display
The convert package convert a image to ascii string or matrix The resize package resize the image to expected size base on the ratio, for the most matched display
example
normal command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL