mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-11-11 01:15:51 +00:00
@@ -49,13 +49,16 @@ RUN apk --no-cache add \
|
|||||||
vips-tools \
|
vips-tools \
|
||||||
vips-poppler \
|
vips-poppler \
|
||||||
vips-jxl \
|
vips-jxl \
|
||||||
|
vips-heif \
|
||||||
|
vips-magick \
|
||||||
libjxl-tools \
|
libjxl-tools \
|
||||||
assimp \
|
assimp \
|
||||||
inkscape \
|
inkscape \
|
||||||
poppler-utils \
|
poppler-utils \
|
||||||
gcompat \
|
gcompat \
|
||||||
libva-utils \
|
libva-utils \
|
||||||
py3-numpy
|
py3-numpy \
|
||||||
|
libheif-tools
|
||||||
|
|
||||||
RUN apk --no-cache add qt6-qtbase-private-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community/
|
RUN apk --no-cache add qt6-qtbase-private-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community/
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ A self-hosted online file converter. Supports over a thousand different formats.
|
|||||||
|------------------------------------------------------------------------------|---------------|---------------|-------------|
|
|------------------------------------------------------------------------------|---------------|---------------|-------------|
|
||||||
| [libjxl](https://github.com/libjxl/libjxl) | JPEG XL | 11 | 11 |
|
| [libjxl](https://github.com/libjxl/libjxl) | JPEG XL | 11 | 11 |
|
||||||
| [resvg](https://github.com/RazrFalcon/resvg) | SVG | 1 | 1 |
|
| [resvg](https://github.com/RazrFalcon/resvg) | SVG | 1 | 1 |
|
||||||
|
| [libheif](https://github.com/strukturag/libheif) | HEIF | 7 | 6 |
|
||||||
| [Vips](https://github.com/libvips/libvips) | Images | 45 | 23 |
|
| [Vips](https://github.com/libvips/libvips) | Images | 45 | 23 |
|
||||||
| [XeLaTeX](https://tug.org/xetex/) | LaTeX | 1 | 1 |
|
| [XeLaTeX](https://tug.org/xetex/) | LaTeX | 1 | 1 |
|
||||||
| [Calibre](https://calibre-ebook.com/) | E-books | 26 | 19 |
|
| [Calibre](https://calibre-ebook.com/) | E-books | 26 | 19 |
|
||||||
|
|||||||
52
src/converters/libheif.ts
Normal file
52
src/converters/libheif.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import { execFile } from "child_process";
|
||||||
|
|
||||||
|
export const properties = {
|
||||||
|
from: {
|
||||||
|
images: [
|
||||||
|
"avci",
|
||||||
|
"avcs",
|
||||||
|
"avif",
|
||||||
|
"h264",
|
||||||
|
"heic",
|
||||||
|
"heics",
|
||||||
|
"heif",
|
||||||
|
"heifs",
|
||||||
|
"mkv",
|
||||||
|
"mp4",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
to: {
|
||||||
|
images: ["jpeg", "png", "y4m"],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export function convert(
|
||||||
|
filePath: string,
|
||||||
|
fileType: string,
|
||||||
|
convertTo: string,
|
||||||
|
targetPath: string,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
options?: unknown,
|
||||||
|
): Promise<string> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
execFile(
|
||||||
|
"heif-convert",
|
||||||
|
[filePath, targetPath],
|
||||||
|
(error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
reject(`error: ${error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stdout) {
|
||||||
|
console.log(`stdout: ${stdout}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stderr) {
|
||||||
|
console.error(`stderr: ${stderr}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve("Done");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import { convert as convertresvg, properties as propertiesresvg } from "./resvg"
|
|||||||
import { convert as convertImage, properties as propertiesImage } from "./vips";
|
import { convert as convertImage, properties as propertiesImage } from "./vips";
|
||||||
import { convert as convertxelatex, properties as propertiesxelatex } from "./xelatex";
|
import { convert as convertxelatex, properties as propertiesxelatex } from "./xelatex";
|
||||||
import { convert as convertCalibre, properties as propertiesCalibre } from "./calibre";
|
import { convert as convertCalibre, properties as propertiesCalibre } from "./calibre";
|
||||||
|
import { convert as convertLibheif, properties as propertiesLibheif } from "./libheif";
|
||||||
|
|
||||||
|
|
||||||
// This should probably be reconstructed so that the functions are not imported instead the functions hook into this to make the converters more modular
|
// This should probably be reconstructed so that the functions are not imported instead the functions hook into this to make the converters more modular
|
||||||
@@ -49,6 +50,10 @@ const properties: Record<
|
|||||||
properties: propertiesresvg,
|
properties: propertiesresvg,
|
||||||
converter: convertresvg,
|
converter: convertresvg,
|
||||||
},
|
},
|
||||||
|
libheif: {
|
||||||
|
properties: propertiesLibheif,
|
||||||
|
converter: convertLibheif,
|
||||||
|
},
|
||||||
vips: {
|
vips: {
|
||||||
properties: propertiesImage,
|
properties: propertiesImage,
|
||||||
converter: convertImage,
|
converter: convertImage,
|
||||||
|
|||||||
Reference in New Issue
Block a user