feat: initial commit of WMOC CEO portfolio with cruise ship parallax and seafarer document compliance platform
This commit is contained in:
20
scripts/make-cutout.mjs
Normal file
20
scripts/make-cutout.mjs
Normal file
@@ -0,0 +1,20 @@
|
||||
import { removeBackground } from '@imgly/background-removal-node';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
async function processImage() {
|
||||
try {
|
||||
const inputPath = path.resolve('public/assets/hero-portrait.jpg');
|
||||
const outputPath = path.resolve('public/assets/hero-cutout.png');
|
||||
console.log('Processing background removal from:', inputPath);
|
||||
|
||||
const blob = await removeBackground(inputPath);
|
||||
const buffer = Buffer.from(await blob.arrayBuffer());
|
||||
fs.writeFileSync(outputPath, buffer);
|
||||
console.log('Successfully saved cutout to:', outputPath);
|
||||
} catch (err) {
|
||||
console.error('Error removing background:', err);
|
||||
}
|
||||
}
|
||||
|
||||
processImage();
|
||||
Reference in New Issue
Block a user