parent
b5e8d82bfa
commit
b4e53dbb8e
1 changed files with 11 additions and 3 deletions
|
|
@ -689,10 +689,18 @@ export async function convert(
|
||||||
fileType: string,
|
fileType: string,
|
||||||
convertTo: string,
|
convertTo: string,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
options?: any,
|
_options?: unknown,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const command = `ffmpeg -i "${filePath}" "${targetPath}"`;
|
|
||||||
|
let extra = "";
|
||||||
|
|
||||||
|
if (convertTo === "ico") {
|
||||||
|
// make sure image is 256x256 or smaller
|
||||||
|
extra = `-filter:v "scale='min(256,iw)':min'(256,ih)':force_original_aspect_ratio=decrease"`
|
||||||
|
}
|
||||||
|
|
||||||
|
const command = `ffmpeg -i "${filePath}" ${extra} "${targetPath}"`;
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
exec(command, (error, stdout, stderr) => {
|
exec(command, (error, stdout, stderr) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue