appPath is not being read correctly
Author: NordlingDevCreated Jan 22, 2023Updated Dec 1, 2024
I am getting an error when running a simple command like this:
import GM from "gm";
const gm = GM.subClass({
imageMagick: "7+",
appPath: "C:\\Program Files\\ImageMagick-7.1.0-Q16\\magick.exe",
});
gm("image.dds").write("image.png", (err) => {
if (err) {
console.error("Error: " + err.message);
return;
}
console.log(`DDS successfully converted to PNG: ${PNG_PATH}`);
});Error: Could not execute GraphicsMagick/ImageMagick: C:\Program Files\ImageMagick-7.1.0-Q16\magick.exemagick "convert" "image.dds" "image.png" this most likely means the gm/convert binaries can't be found
It's clear to me that the command line is being incorrectly parsed due to this part:
C:\Program Files\ImageMagick-7.1.0-Q16magick ...
If I change appPath to "C:\\Program Files\\ImageMagick-7.1.0-Q16\\" (yes, including the trailing backslash), it works. Because then the command line becomes:
C:\Program Files\ImageMagick-7.1.0-Q16\magick ...
System: Windows 11 Pro (21H2) gm version: 1.25.0
Source: aheckmann/gm