ASCIInator/server/lib/imagemagick.js

18 lines
465 B
JavaScript
Raw Normal View History

import { execa } from 'execa'
import { randomUUID } from 'node:crypto'
export async function preprocess(inputPath, format = 'png') {
const outputPath = `/tmp/asciinator-${randomUUID()}-processed.${format}`
await execa('magick', [
inputPath,
'-strip',
'-auto-orient',
'-resize', '2000x2000>',
outputPath,
])
return outputPath
}
// Reserved for future brightness/contrast post-processing
export async function postprocess(_imagePath) {}