tools.go 195 B

12345678910
  1. package image
  2. type Tool struct {
  3. }
  4. // CustomScale 获取缩放比例
  5. func CustomScale(width, dWidth uint) float64 {
  6. f := float64(width) / float64(dWidth)
  7. return float64(int(f*1000)) / 1000
  8. }