Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

824
Visualizações
How to fix the GraphicsMagik error (gm convert: No decode delegate for this image format)

So I'm trying to make a small app that takes PDF files and converts them to pictures in node.js.

I found that the package pdf2pic is pretty good for what I wanted to do.

So as instructed in that package I went and installed Ghostscript and Graphicsmagick then I installed the package. I'm on Windows btw.

here is my node.js code:

const { fromPath } = require("pdf2pic");

const options = {
  density: 100,
  saveFilename: "untitled",
  savePath: "./images",
  format: "png",
  width: 600,
  height: 600
};
const storeAsImage = fromPath("test.pdf", options);
const pageToConvertAsImage = 1;

storeAsImage(pageToConvertAsImage).then((resolve) => {
  console.log("Page 1 is now converted as image");

  return resolve;
}).catch(error => {
    console.log(error);
});

After I tun this code I get this error:

Error: Command failed: gm convert: No decode delegate for this image format (C:\Users\Yosse_M\AppData\Local\Temp\gmRuQc4v).

    at ChildProcess.onExit (D:\Devs\NodeJS\app07-pdf2pic-test\node_modules\gm\lib\command.js:301:17)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.cp.emit (D:\Devs\NodeJS\app07-pdf2pic-test\node_modules\cross-spawn\lib\enoent.js:40:29)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
  code: 1,
  signal: null

Here is what the command gm -version returns:

C:\Users\Yosse_M>gm -version
GraphicsMagick 1.3.36 20201226 Q16 http://www.GraphicsMagick.org/
Copyright (C) 2002-2020 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.

Feature Support:
  Native Thread Safe         yes
  Large Files (> 32 bit)     yes
  Large Memory (> 32 bit)    yes
  BZIP                       yes
  DPS                        no
  FlashPix                   no
  FreeType                   yes
  Ghostscript (Library)      no
  JBIG                       yes
  JPEG-2000                  yes
  JPEG                       yes
  Little CMS                 yes
  Loadable Modules           yes
  Solaris mtmalloc           no
  Google perftools tcmalloc  no
  OpenMP                     yes (200203 "2.0")
  PNG                        yes
  TIFF                       yes
  TRIO                       no
  Solaris umem               no
  WebP                       yes
  WMF                        yes
  X11                        no
  XML                        yes
  ZLIB                       yes

Windows Build Parameters:

  MSVC Version:            1500

I have no idea how to go about fixing this problem, can I please get some advice.

Please if you need any more info, let me know.

Thank you

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I was struggling with "GM's pdf delegate problem" too. And I found out that GraphicsMagick uses the Ghostscript Fonts (also known as "URW Fonts") to support the standard set of Adobe Postscript fonts like "Helvetica" and "Times Roman". Download fonts from here Ghostscript Fonts and paste downloaded folder fonts to the folder with Ghostscript files C:Program Files\gs\gs9.52. Here you could find more information. enter image description here

const { fromPath } = require("pdf2pic");

const options = {
  density: 100,
  saveFilename: "untitled",
  savePath: "./images",
  format: "png",
  width: 600,
  height: 600
};

try {
    const convert = fromPath("test.pdf", options);
    await convert.bulk(-1);
} catch (error) {
    console.log(error);

}

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda