code: func Thumbnail(maxWidth, maxHeight uint, img image.Image, interp InterpolationFunction) image.Image {
  	origBounds := img.Bounds()
  	origWidth := uint(origBounds.Dx())
  	origHeight := uint(origBounds.Dy())
  	newWidth, newHeight := origWidth, origHeight
  
  	// Return original image if it have same or smaller size as constraints
  	if maxWidth >= origWidth && maxHeight >= origHeight {
  		return img
  	}
  
  	// Preserve aspect ratio
  	if origWidth > maxWidth {
  		newHeight = uint(origHeight * maxWidth / origWidth)
  		if newHeight < 1 {
  			newHeight = 1
  		}
  		newWidth = maxWidth
  	}
  
  	if newHeight > maxHeight {
  		newWidth = uint(newWidth * maxHeight / newHeight)
  		if newWidth < 1 {
  			newWidth = 1
  		}
  		newHeight = maxHeight
  	}
  	return Resize(newWidth, newHeight, img, interp)
  }
docs: // Thumbnail will downscale provided image to max width and height preserving
  // original aspect ratio and using the interpolation function interp.
  // It will return original image, without processing it, if original sizes
  // are already smaller than provided constraints.