async function createThumbnails (target, images) {
  for (const x of images) {
    const imagePath = path.join(target, x)
    const thumbPath = path.join(target, `${x}.thumb.jpg`)

    try {
      // Background and flatten are for transparent PNGs/Gifs.
      // We force a white background here.

      await sharp(imagePath)
        .resize(450)
        .background({r: 255, g: 255, b: 255, alpha: 1})
        .flatten()
        .jpeg()
        .toFile(thumbPath)
    } catch (e) {
      const msg = chalk.dim(`(${e.message})`)
      console.warn(`The '${chalk.bold(x)}' thumbnail has not been generated. ${msg}`)
    }
  }
}
async function createThumbnails (target, images) {
  for (const x of images) {
    const imagePath = path.join(target, x)
    const thumbPath = path.join(target, `${x}.thumb.jpg`)

    try {
      
      

      await sharp(imagePath)
        .resize(450)
        .background({r: 255, g: 255, b: 255, alpha: 1})
        .flatten()
        .jpeg()
        .toFile(thumbPath)
    } catch (e) {
      const msg = chalk.dim(`(${e.message})`)
      console.warn(`The '${chalk.bold(x)}' thumbnail has not been generated. ${msg}`)
    }
  }
}
async function createThumbnails ( target , images ) { for ( const x of images ) { const imagePath = path . join ( target , x ) const thumbPath = path . join ( target , ` ${ x } ` ) try { // Background and flatten are for transparent PNGs/Gifs. // We force a white background here. await sharp ( imagePath ) . resize ( 450 ) . background ( { r : 255 , g : 255 , b : 255 , alpha : 1 } ) . flatten ( ) . jpeg ( ) . toFile ( thumbPath ) } catch ( e ) { const msg = chalk . dim ( ` ${ e . message } ` ) console . warn ( ` ${ chalk . bold ( x ) } ${ msg } ` ) } } }
Create thumbnails. For each provided images, generate a low-res jpg thumbnail. Even for gif.  We don't check if the format of the images is valid, since the check is already done when constructing the images object.
Create thumbnails . For each provided images generate a low - res jpg thumbnail . Even for gif . We don t check if the format of the images is valid since the check is already done when constructing the images object .