Using image.bounds().Max.X or Y causes the Pix traversal to run out of bounds. Now using image.bounds().Dx() or Dy() for all cases.
This is because if an image rectangle has a non-zero starting point bounds (such as 1,1-3,3 for a 2x2 image), then the bounds().Max would return 3 as length for X and Y instead of 2. So the delta is what is really needed.
Using image.bounds().Max.X or Y causes the Pix traversal to run out of bounds. Now using image.bounds().Dx() or Dy() for all cases.
This is because if an image rectangle has a non-zero starting point bounds (such as 1,1-3,3 for a 2x2 image), then the bounds().Max would return 3 as length for X and Y instead of 2. So the delta is what is really needed.