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-3/

Social Media Text Banner Generator

A service that generates text banners for social media posts by rendering text as images with customizable styling.

Capabilities

Generate simple text banner

  • Given the text "Hello World", generates a PNG image buffer with that text rendered @test
  • Given an empty string, generates a PNG image buffer with no visible text @test

Generate styled text banner

  • Given the text "Sale Today!" with font size 48 and specific dimensions (800x200), generates a correctly sized PNG image buffer @test
  • Given the text "Special Offer\nLimited Time" with center alignment, generates a PNG image buffer with centered multi-line text @test

Implementation

@generates

API

/**
 * Generates a text banner image.
 *
 * @param {string} text - The text to render in the banner
 * @param {Object} options - Configuration options for the banner
 * @param {number} [options.width=400] - Width of the banner in pixels
 * @param {number} [options.height=100] - Height of the banner in pixels
 * @param {number} [options.fontSize=24] - Font size in points
 * @param {string} [options.align='left'] - Text alignment: 'left', 'center', or 'right'
 * @returns {Promise<Buffer>} A promise that resolves to a PNG image buffer
 */
async function generateBanner(text, options = {}) {
  // IMPLEMENTATION HERE
}

module.exports = {
  generateBanner
};

Dependencies { .dependencies }

sharp { .dependency }

High-performance image processing library for Node.js.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-sharp

tile.json