From 1bc839449862f554fce7811d83c871c2665fd1f1 Mon Sep 17 00:00:00 2001 From: qeesung <1245712564@qq.com> Date: Sun, 28 Oct 2018 15:25:37 +0800 Subject: [PATCH] Fxied the fetched wrong image width and height issue --- convert/convert.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/convert/convert.go b/convert/convert.go index edf0f17..2ae8c82 100644 --- a/convert/convert.go +++ b/convert/convert.go @@ -39,11 +39,11 @@ func Image2ASCIIMatrix(image image.Image, imageConvertOptions *Options) []string // Resize the convert first newImage := ScaleImage(image, imageConvertOptions) sz := newImage.Bounds() - newWidth := sz.Max.Y - newHeight := sz.Max.X + newWidth := sz.Max.X + newHeight := sz.Max.Y rawCharValues := make([]string, 0, int(newWidth*newHeight+newWidth)) - for i := 0; i < int(newWidth); i++ { - for j := 0; j < int(newHeight); j++ { + for i := 0; i < int(newHeight); i++ { + for j := 0; j < int(newWidth); j++ { pixel := color.NRGBAModel.Convert(newImage.At(j, i)) // Convert the pixel to ascii char pixelConvertOptions := ascii.NewOptions() -- 2.45.2