mirror of
https://github.com/koush/scrypted.git
synced 2026-02-18 12:32:37 +00:00
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import { writeFileSync } from "fs";
|
|
import { ffmpegFilterImage } from "../src/ffmpeg-image-filter";
|
|
import { sharpFilterImage } from "../src/sharp-image-filter";
|
|
|
|
async function main1() {
|
|
const ret = await ffmpegFilterImage(['-i', '/Users/koush/Downloads/151-1678381127261.jpg'],
|
|
{
|
|
blur: true,
|
|
// // crop: {
|
|
// // // fractional: true,
|
|
// // left: 100,
|
|
// // top: 100,
|
|
// // width: 1000,
|
|
// // height: 500,
|
|
// // }
|
|
brightness: -.2,
|
|
// // text: {
|
|
// // fontFile: path.join(__dirname, '../fs/Lato-Bold.ttf'),
|
|
// // text: 'Hello World',
|
|
// // }
|
|
// }
|
|
// { "crop": { "left": 0.216796875, "top": 0.2552083333333333, "width": 0.318359375, "height": 0.17907714843749994, "fractional": true }
|
|
}
|
|
);
|
|
writeFileSync('test1.jpg', ret);
|
|
console.log('test1 done');
|
|
}
|
|
|
|
async function main2() {
|
|
const ret = await sharpFilterImage('/Users/koush/Downloads/151-1678381127261.jpg',
|
|
{
|
|
blur: true,
|
|
// crop: {
|
|
// // fractional: true,
|
|
// left: 100,
|
|
// top: 100,
|
|
// width: 1000,
|
|
// height: 500,
|
|
// },
|
|
brightness: -.2,
|
|
// // text: {
|
|
// // fontFile: path.join(__dirname, '../fs/Lato-Bold.ttf'),
|
|
// // text: 'Hello World',
|
|
// // }
|
|
// }
|
|
// { "crop": { "left": 0.216796875, "top": 0.2552083333333333, "width": 0.318359375, "height": 0.17907714843749994, "fractional": true }
|
|
}
|
|
);
|
|
writeFileSync('test2.jpg', ret);
|
|
console.log('test2 done');
|
|
}
|
|
|
|
main1();
|
|
main2();
|