docs: function resizePromise(img, width=0, height=0) {
      return new Promise((resolve, reject) => {
          let loaded = typeof img == 'string' // url
          let image
          if (loaded) {
              image = new Image
              image.onload = () => {
                  if (image.width <= width || image.height <= height || (width == 0 && height == 0)) {
                      // nothing changes
                      resolve(scalingHelper(image, 1))
                  }else {
                      resolve(resample(image, width, height))
                  }
              }
              image.onerror = () => {
                  console.error('image resize error here!!!')
                  reject('resize error')
              }
              image.src = img
          } else {
              image = img
              if (image.width <= width || image.height <= height || (width == 0 && height == 0)) {
                  // nothing changes
                  resolve(scalingHelper(image, 1))
              }else {
                  resolve(resample(image, width, height))
              }
          }
      })
  }