create-test-image.js•612 B
import sharp from 'sharp';
// Create a simple test image
const width = 300;
const height = 200;
const backgroundColor = { r: 255, g: 0, b: 0, alpha: 1 };
async function createTestImage() {
try {
// Create a solid red image
await sharp({
create: {
width,
height,
channels: 4,
background: backgroundColor
}
})
.jpeg()
.toFile('test-images/test-image.jpg');
console.log('Test image created successfully at test-images/test-image.jpg');
} catch (error) {
console.error('Error creating test image:', error);
}
}
createTestImage();