The max point of a bounding rectangle for an image.Image is exclusive.
So the current loops
for y := i; y <= image1.Bounds().Max.Y; y += cpus {
for x := 0; x <= image1.Bounds().Max.X; x++ {
actually go one past the end.
Replace both <= with <.
Luckily Image.At doesn't panic in this case, but the code is still technically wrong.
The max point of a bounding rectangle for an
image.Imageis exclusive.So the current loops
actually go one past the end.
Replace both
<=with<.Luckily
Image.Atdoesn't panic in this case, but the code is still technically wrong.