async function vibrant(storage, imagePreviewSuffix) {

  const test = entry => storage.hasFile(entry, imagePreviewSuffix) && !storage.hasFile(entry, vibrantSuffix)

  const task = async (entry) => {
    const t0 = Date.now();
    const localFile = await storage.createLocalFile(entry, imagePreviewSuffix)

    return new Promise((resolve, reject) => {
      Vibrant
        .from(localFile.file)
        .getPalette((err, palette) => {
          if (err) {
            return reject(err)
          }
          resolve(palette)
        })
    })
    .then(palette => storage.writeFile(entry, vibrantSuffix, palette))
    .then(() => {
      log.debug(t0, `Extracted vibrant colors from ${entry}`);
    })
    .catch(err => {
      log.error(err, `Could not extract vibrant colors of ${entry}: ${err}`);
    })
    .finally(async () => {
      return localFile?.release()
    })
  }

  return {
    test,
    task
  }
}
@param {import('@home-gallery/types').TStorage} storage
@param {number[]} imagePreviewSizes
@returns {import('stream').Transform}