Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appPath is not being read correctly #852

Open
NordlingDev opened this issue Jan 22, 2023 · 2 comments
Open

appPath is not being read correctly #852

NordlingDev opened this issue Jan 22, 2023 · 2 comments

Comments

@NordlingDev
Copy link

NordlingDev commented Jan 22, 2023

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

@si458
Copy link

si458 commented Mar 13, 2023

im having the exact same issue now, did you find an answer as to why this happens?

@ryanmz1
Copy link

ryanmz1 commented Apr 17, 2023

im having the exact same issue now, did you find an answer as to why this happens?

as @NordlingDev said, try writing appPath like below:

import GM from "gm";

const gm = GM.subClass({
  imageMagick: "7+",
  appPath: String.raw`C:\\Program Files\\ImageMagick-7.1.0-Q16\\`,
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants