Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use the updated im 7

Manav Rathid836e190e3fd
diff --git a/desktop/docs/dependencies.md b/desktop/docs/dependencies.md
index 46fd1dacaa..fc05d70ccb 100644
--- a/desktop/docs/dependencies.md
+++ b/desktop/docs/dependencies.md
@@ -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
diff --git a/desktop/src/main/services/image.ts b/desktop/src/main/services/image.ts
index fca4628b63..e533a49274 100644
--- a/desktop/src/main/services/image.ts
+++ b/desktop/src/main/services/image.ts
@@ -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);
}
};