diff --git a/README.md b/README.md index 6a13127..267231a 100644 --- a/README.md +++ b/README.md @@ -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. ``` diff --git a/aic_package/convert_root.go b/aic_package/convert_root.go index ddbf17e..9e780dd 100644 --- a/aic_package/convert_root.go +++ b/aic_package/convert_root.go @@ -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 { diff --git a/aic_package/util.go b/aic_package/util.go index a71a712..dcd0f81 100644 --- a/aic_package/util.go +++ b/aic_package/util.go @@ -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() diff --git a/cmd/root.go b/cmd/root.go index 46ee50f..38eb74d 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -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") diff --git a/snapcraft.yaml b/snapcraft.yaml index 5f50333..b5ebc44 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -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