CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-sharp

High performance Node.js image processing library for resizing JPEG, PNG, WebP, GIF, AVIF and TIFF images

80

1.01x
Overview
Eval results
Files

task.mdevals/scenario-10/

Image Slideshow Generator

Build a tool that creates animated image slideshows from a series of static images. The tool should support multiple output formats including GIF, WebP, and JXL animations.

Requirements

The tool must accept a directory of image files and generate animated slideshows with the following features:

Input Handling

  • Accept a directory path containing multiple image files (JPEG, PNG, or WebP)
  • Load all images from the directory and prepare them for animation

Animation Configuration

  • Support configurable frame delay in milliseconds (time each image is displayed)
  • Support configurable loop count (0 for infinite loop, or a specific number of repetitions)
  • Ensure all frames are resized to consistent dimensions before animation

Output Formats

  • Generate animated GIF format with optimized palette
  • Generate animated WebP format with lossy compression
  • Generate animated JXL format (if supported)
  • All three formats should be created from the same input sequence

Output Requirements

  • Save each animation format to a file with appropriate extension
  • Apply consistent quality settings across formats where applicable

Test Cases

  • Given a directory with 3 JPEG images, generates a GIF animation with 500ms frame delay and infinite loop @test
  • Given a directory with 4 PNG images, generates a WebP animation with 300ms frame delay and 2 loop iterations @test
  • Given a directory with mixed format images, all output animations have consistent frame dimensions @test

Implementation

@generates

API

/**
 * Creates animated slideshows in multiple formats from a directory of images
 *
 * @param {string} inputDir - Path to directory containing source images
 * @param {string} outputPrefix - Prefix for output animation files
 * @param {Object} options - Animation configuration
 * @param {number} options.delay - Frame delay in milliseconds (default: 500)
 * @param {number} options.loop - Loop count, 0 for infinite (default: 0)
 * @param {number} options.width - Target width for all frames (default: 800)
 * @param {number} options.height - Target height for all frames (default: 600)
 * @returns {Promise<Object>} Object with paths to created animation files
 */
async function createSlideshow(inputDir, outputPrefix, options = {}) {
  // IMPLEMENTATION HERE
}

module.exports = { createSlideshow };

Dependencies { .dependencies }

sharp { .dependency }

Provides high-performance image processing and animation creation support.

Install with Tessl CLI

npx tessl i tessl/npm-sharp

tile.json