code: func Resize(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA {
  	dstW, dstH := width, height
  	if dstW < 0 || dstH < 0 {
  		return &image.NRGBA{}
  	}
  	if dstW == 0 && dstH == 0 {
  		return &image.NRGBA{}
  	}
  
  	srcW := img.Bounds().Dx()
  	srcH := img.Bounds().Dy()
  	if srcW <= 0 || srcH <= 0 {
  		return &image.NRGBA{}
  	}
  
  	// If new width or height is 0 then preserve aspect ratio, minimum 1px.
  	if dstW == 0 {
  		tmpW := float64(dstH) * float64(srcW) / float64(srcH)
  		dstW = int(math.Max(1.0, math.Floor(tmpW+0.5)))
  	}
  	if dstH == 0 {
  		tmpH := float64(dstW) * float64(srcH) / float64(srcW)
  		dstH = int(math.Max(1.0, math.Floor(tmpH+0.5)))
  	}
  
  	if filter.Support <= 0 {
  		// Nearest-neighbor special case.
  		return resizeNearest(img, dstW, dstH)
  	}
  
  	if srcW != dstW && srcH != dstH {
  		return resizeVertical(resizeHorizontal(img, dstW, filter), dstH, filter)
  	}
  	if srcW != dstW {
  		return resizeHorizontal(img, dstW, filter)
  	}
  	if srcH != dstH {
  		return resizeVertical(img, dstH, filter)
  	}
  	return Clone(img)
  }
docs: // Resize resizes the image to the specified width and height using the specified resampling
  // filter and returns the transformed image. If one of width or height is 0, the image aspect
  // ratio is preserved.
  //
  // Example:
  //
  //	dstImage := imaging.Resize(srcImage, 800, 600, imaging.Lanczos)
  //