code: func calcFactors(width, height uint, oldWidth, oldHeight float64) (scaleX, scaleY float64) {
  	if width == 0 {
  		if height == 0 {
  			scaleX = 1.0
  			scaleY = 1.0
  		} else {
  			scaleY = oldHeight / float64(height)
  			scaleX = scaleY
  		}
  	} else {
  		scaleX = oldWidth / float64(width)
  		if height == 0 {
  			scaleY = scaleX
  		} else {
  			scaleY = oldHeight / float64(height)
  		}
  	}
  	return
  }
docs: // Calculates scaling factors using old and new image dimensions.