Fixed bug where some pixels were lost on max brightness pixels

This commit is contained in:
Zoraiz 2021-05-12 14:28:06 +05:00
parent ea1979ef92
commit 1bc953f59e
2 changed files with 5 additions and 7 deletions

View File

@ -128,7 +128,7 @@ func ConvertToAsciiDetailed(imgSet [][]uint32) [][]string {
tempFloat := (value / MAX_VAL) * float32(len(asciiTableDetailed)) tempFloat := (value / MAX_VAL) * float32(len(asciiTableDetailed))
if value == MAX_VAL { if value == MAX_VAL {
tempFloat = 68 tempFloat = float32(len(asciiTableDetailed) - 1)
} }
tempInt := int(tempFloat) tempInt := int(tempFloat)
@ -160,6 +160,9 @@ func ConvertToAsciiSimple(imgSet [][]uint32) [][]string {
value := float32(imgSet[i][j]) value := float32(imgSet[i][j])
tempFloat := (value / MAX_VAL) * float32(len(asciiTableSimple)) tempFloat := (value / MAX_VAL) * float32(len(asciiTableSimple))
if value == MAX_VAL {
tempFloat = float32(len(asciiTableSimple) - 1)
}
tempInt := int(tempFloat) tempInt := int(tempFloat)
tempSlice = append(tempSlice, asciiTableSimple[tempInt]) tempSlice = append(tempSlice, asciiTableSimple[tempInt])

View File

@ -16,13 +16,8 @@ limitations under the License.
package main package main
import ( import "ascii-image-converter/cmd"
"ascii-image-converter/cmd"
)
func main() { func main() {
cmd.Execute() cmd.Execute()
// cols, rows := consolesize.GetConsoleSize()
// // fmt.Println(cols, rows)
} }