mirror of
https://github.com/ente-io/ente.git
synced 2025-08-07 23:18:10 +00:00
Use the updated im 7
This commit is contained in:
parent
75509ff339
commit
d836e190e3
@ -103,7 +103,7 @@ Some extra ones specific to the code here are:
|
||||
|
||||
### Format conversion
|
||||
|
||||
The main tool we use is for arbitrary conversions is ffmpeg. To bundle a
|
||||
For video conversions and metadata extraction, we use ffmpeg. To bundle a
|
||||
(platform specific) static binary of ffmpeg with our app, we use
|
||||
[ffmpeg-static](https://github.com/eugeneware/ffmpeg-static).
|
||||
|
||||
@ -111,11 +111,11 @@ The main tool we use is for arbitrary conversions is ffmpeg. To bundle a
|
||||
> ffmpeg binary and using the wasm one (that our renderer process already has).
|
||||
> Which is why we bundle it to speed up operations on the desktop app.
|
||||
|
||||
On Linux and Windows, we use ImageMagick for thumbnail generation. A static
|
||||
OS/architecture specific binary of this is bundled in our extra resources
|
||||
(`build`) folder by `scripts/magick.sh`.
|
||||
On Linux and Windows, we use ImageMagick for thumbnail generation and JPEG
|
||||
conversion of unpreviewable images. A static OS/architecture specific binary of
|
||||
this is bundled in our extra resources (`build`) folder by `scripts/magick.sh`.
|
||||
|
||||
On macOS, we use the `sips` CLI tool for conversion, but that is already
|
||||
On macOS, we use the `sips` CLI tool for these tasks, but that is already
|
||||
available on the host machine, and is not bundled with our app.
|
||||
|
||||
### ML
|
||||
|
@ -44,25 +44,29 @@ const convertToJPEGCommand = (
|
||||
];
|
||||
|
||||
case "linux":
|
||||
// The bundled binary is an ELF x86-64 executable.
|
||||
if (process.arch != "x64")
|
||||
case "win32":
|
||||
// The bundled binary is for x86 and arm64.
|
||||
if (process.arch != "x64" && process.arch != "arm64")
|
||||
throw new Error(CustomErrorMessage.NotAvailable);
|
||||
return [
|
||||
imageMagickPath(),
|
||||
"convert",
|
||||
inputFilePath,
|
||||
"-quality",
|
||||
"100%",
|
||||
outputFilePath,
|
||||
];
|
||||
|
||||
default: // "win32"
|
||||
default:
|
||||
throw new Error(CustomErrorMessage.NotAvailable);
|
||||
}
|
||||
};
|
||||
|
||||
/** Path to the Linux image-magick executable bundled with our app */
|
||||
/**
|
||||
* Path to the magick executable bundled with our app on Linux and Windows.
|
||||
*/
|
||||
const imageMagickPath = () =>
|
||||
path.join(isDev ? "build" : process.resourcesPath, "image-magick");
|
||||
path.join(isDev ? "build" : process.resourcesPath, "magick");
|
||||
|
||||
export const generateImageThumbnail = async (
|
||||
dataOrPathOrZipItem: Uint8Array | string | ZipItem,
|
||||
@ -133,14 +137,16 @@ const generateImageThumbnailCommand = (
|
||||
];
|
||||
|
||||
case "linux":
|
||||
// The bundled binary is an ELF x86-64 executable.
|
||||
if (process.arch != "x64")
|
||||
case "win32":
|
||||
// The bundled binary is for x86 and arm64.
|
||||
if (process.arch != "x64" && process.arch != "arm64")
|
||||
throw new Error(CustomErrorMessage.NotAvailable);
|
||||
return [
|
||||
imageMagickPath(),
|
||||
"convert",
|
||||
inputFilePath,
|
||||
"-define",
|
||||
`jpeg:size=${2 * maxDimension}x${2 * maxDimension}`,
|
||||
inputFilePath,
|
||||
"-auto-orient",
|
||||
"-thumbnail",
|
||||
`${maxDimension}x${maxDimension}`,
|
||||
@ -151,7 +157,7 @@ const generateImageThumbnailCommand = (
|
||||
outputFilePath,
|
||||
];
|
||||
|
||||
default: // "win32"
|
||||
default:
|
||||
throw new Error(CustomErrorMessage.NotAvailable);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user