code: func resizeNearest(img image.Image, width, height int) *image.NRGBA {
  	dst := image.NewNRGBA(image.Rect(0, 0, width, height))
  	dx := float64(img.Bounds().Dx()) / float64(width)
  	dy := float64(img.Bounds().Dy()) / float64(height)
  
  	if dx > 1 && dy > 1 {
  		src := newScanner(img)
  		parallel(0, height, func(ys <-chan int) {
  			for y := range ys {
  				srcY := int((float64(y) + 0.5) * dy)
  				dstOff := y * dst.Stride
  				for x := 0; x < width; x++ {
  					srcX := int((float64(x) + 0.5) * dx)
  					src.scan(srcX, srcY, srcX+1, srcY+1, dst.Pix[dstOff:dstOff+4])
  					dstOff += 4
  				}
  			}
  		})
  	} else {
  		src := toNRGBA(img)
  		parallel(0, height, func(ys <-chan int) {
  			for y := range ys {
  				srcY := int((float64(y) + 0.5) * dy)
  				srcOff0 := srcY * src.Stride
  				dstOff := y * dst.Stride
  				for x := 0; x < width; x++ {
  					srcX := int((float64(x) + 0.5) * dx)
  					srcOff := srcOff0 + srcX*4
  					copy(dst.Pix[dstOff:dstOff+4], src.Pix[srcOff:srcOff+4])
  					dstOff += 4
  				}
  			}
  		})
  	}
  
  	return dst
  }
docs: // resizeNearest is a fast nearest-neighbor resize, no filtering.