High performance Node.js image processing library for resizing JPEG, PNG, WebP, GIF, AVIF and TIFF images
80
Create a command-line tool that adds decorative borders to images. The tool should support different border styles and allow users to customize the border size and appearance.
The tool should add borders with a solid color around an image.
The tool should support borders that extend the edge pixels of the image.
The tool should support borders that mirror the image content.
The tool should work with common image formats.
@generates
/**
* Adds a border to an image
*
* @param {string|Buffer} input - Path to input image or image buffer
* @param {Object} options - Border configuration
* @param {number} options.size - Border size in pixels (used for all sides if specific sizes not provided)
* @param {number} [options.top] - Top border size in pixels (overrides size)
* @param {number} [options.right] - Right border size in pixels (overrides size)
* @param {number} [options.bottom] - Bottom border size in pixels (overrides size)
* @param {number} [options.left] - Left border size in pixels (overrides size)
* @param {string} [options.style='solid'] - Border style: 'solid', 'edge', 'mirror', 'repeat'
* @param {string} [options.color='#000000'] - Border color (hex format) for solid style
* @returns {Promise<Buffer>} Promise resolving to the processed image buffer
*/
async function addBorder(input, options) {
// IMPLEMENTATION HERE
}
module.exports = {
addBorder
};Provides high-performance image processing capabilities including border extension.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-sharpdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10