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

Image Rotation Processor

Build an image processing module that handles various rotation operations including EXIF-based auto-orientation, 90-degree rotations, and arbitrary angle rotations.

Capabilities

Auto-orientation from EXIF

Automatically correct image orientation based on EXIF metadata.

  • Auto-orienting a landscape JPEG image with EXIF orientation tag 6 produces an image rotated 90° clockwise @test

90-degree rotations

Rotate images by multiples of 90 degrees clockwise without quality loss.

  • Rotating a 100x200 PNG image 90° clockwise once produces a 200x100 image @test
  • Rotating a square image by 180° produces the same dimensions with content upside-down @test

Arbitrary angle rotation

Rotate images by any angle with black background fill for empty areas.

  • Rotating an image by 45° produces an image with black corners in the empty areas @test
  • Rotating an image by -30° rotates counter-clockwise with black background fill @test

Combined operations

Chain auto-orientation with additional rotation.

  • Auto-orienting an image with EXIF orientation 1 and then rotating by 90° produces an image rotated 90° clockwise @test

API

/**
 * Reads an image and applies its EXIF orientation, then saves the corrected image.
 * @param {string} inputPath - Path to the input image file
 * @param {string} outputPath - Path where the corrected image will be saved
 * @returns {Promise<void>} Promise that resolves when processing is complete
 */
async function autoOrient(inputPath, outputPath) {}

/**
 * Rotates an image by 90 degrees clockwise, repeated multiple times.
 * @param {string} inputPath - Path to the input image file
 * @param {string} outputPath - Path where the rotated image will be saved
 * @param {number} times - Number of times to rotate by 90° (e.g., 2 means 180°)
 * @returns {Promise<void>} Promise that resolves when processing is complete
 */
async function rotate90(inputPath, outputPath, times) {}

/**
 * Rotates an image by the specified angle in degrees.
 * @param {string} inputPath - Path to the input image file
 * @param {string} outputPath - Path where the rotated image will be saved
 * @param {number} degrees - Angle in degrees (positive = clockwise, negative = counter-clockwise)
 * @returns {Promise<void>} Promise that resolves when processing is complete
 */
async function rotateByAngle(inputPath, outputPath, degrees) {}

/**
 * First auto-orients the image based on EXIF, then rotates by the specified angle.
 * @param {string} inputPath - Path to the input image file
 * @param {string} outputPath - Path where the processed image will be saved
 * @param {number} degrees - Angle in degrees to rotate after auto-orientation
 * @returns {Promise<void>} Promise that resolves when processing is complete
 */
async function autoOrientAndRotate(inputPath, outputPath, degrees) {}

module.exports = { autoOrient, rotate90, rotateByAngle, autoOrientAndRotate };

Dependencies { .dependencies }

sharp { .dependency }

Provides high-performance image processing capabilities.

Install with Tessl CLI

npx tessl i tessl/npm-sharp

tile.json