This commit is contained in:
Zoraiz 2021-09-10 16:09:19 +05:00
parent 178c48fbe1
commit 6793039277
5 changed files with 15 additions and 5 deletions

View File

@ -162,6 +162,8 @@ ascii-image-converter myImage.jpeg
#### --color OR -C
> **Note:** Your terminal must support 24-bit colors for appropriate results
Display ascii art with the colors from original image. Works with the --negative flag as well.
```

View File

@ -32,7 +32,6 @@ import (
_ "golang.org/x/image/tiff"
_ "golang.org/x/image/webp"
"github.com/asaskevich/govalidator"
"github.com/golang/freetype/truetype"
)
@ -107,7 +106,7 @@ func Convert(filePath string, flags Flags) (string, error) {
err error
)
pathIsURl := govalidator.IsRequestURL(filePath)
pathIsURl := isURL(filePath)
// Different modes of reading data depending upon whether or not filePath is a url
if pathIsURl {

View File

@ -119,6 +119,15 @@ func getFullSavePath(imageName, saveFilePath string) (string, error) {
}
}
func isURL(urlString string) bool {
if len(urlString) < 7 {
return false
} else if urlString[:7] == "http://" || urlString[:8] == "https://" {
return true
}
return false
}
// Following is for clearing screen when showing gif
var clear map[string]func()

View File

@ -57,7 +57,7 @@ var (
rootCmd = &cobra.Command{
Use: "ascii-image-converter [image paths/urls]",
Short: "Converts images and gifs into ascii art",
Version: "1.9.1",
Version: "1.9.2",
Long: "This tool converts images into ascii art and prints them on the terminal.\nFurther configuration can be managed with flags.",
// Not RunE since help text is getting larger and seeing it for every error impacts user experience
@ -128,7 +128,7 @@ func init() {
rootCmd.Flags().SortFlags = false
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.ascii-image-converter.yaml)")
rootCmd.PersistentFlags().BoolVarP(&colored, "color", "C", false, "Display ascii art with original colors\n(Inverts with --negative flag)\n(Overrides --grayscale and --font-color flags)\n")
rootCmd.PersistentFlags().BoolVarP(&colored, "color", "C", false, "Display ascii art with original colors\nTerminal must support 24-bit colors\n(Inverts with --negative flag)\n(Overrides --grayscale and --font-color flags)\n")
rootCmd.PersistentFlags().BoolVar(&colorBg, "color-bg", false, "If some color flag is passed, use that color\non character background instead of foreground\n(Inverts with --negative flag)\n(Only applicable for terminal display)\n")
rootCmd.PersistentFlags().IntSliceVarP(&dimensions, "dimensions", "d", nil, "Set width and height for ascii art in CHARACTER length\ne.g. -d 60,30 (defaults to terminal height)\n(Overrides --width and --height flags)\n")
rootCmd.PersistentFlags().IntVarP(&width, "width", "W", 0, "Set width for ascii art in CHARACTER length\nHeight is kept to aspect ratio\ne.g. -W 60\n")

View File

@ -1,6 +1,6 @@
name: ascii-image-converter
base: core18
version: "1.9.1"
version: "1.9.2"
summary: Convert images and gifs into ascii art
description: |
ascii-image-converter is a command-line tool that converts images into ascii art and prints