Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

[Intermittent Error] Command failed: gm identify: Unable to open file (/tmp/gm4yFeyx) [Invalid argument]. #868

Open
kirito286 opened this issue Jul 9, 2024 · 0 comments

Comments

@kirito286
Copy link

Intermittent Error Message:

Error: Command failed: gm identify: Unable to open file (/tmp/gm4yFeyx) [Invalid argument].
gm identify: Request did not return an image.

Code Snippet:

const convertPDFToImages = async (
    pdfFile: Express.Multer.File
) => {
    const options = {
        density: 300,
        width: 1200,
        height: 1800,
        format: 'png',
        savePath: pdfFile.destination,
        saveFilename: pdfFile.filename.replace(/\.[^/.]+$/, ''),
    };    
    const convert = fromPath(pdfFile.path, options);

    try {
        const images = await convert.bulk(-1);
        console.log('images==>', images);
    } catch (error) {
        console.error('Error during conversion:', error);
    }
}

The issue occurs intermittently during the conversion of a PDF file to PNG images using GraphicsMagick (gm) within a Node.js environment. The error message suggests a problem with opening the temporary file (/tmp/gm4yFeyx) and indicates that the identify request did not return an image.

Environment Details:

  • Node Version: node:14.5.0-alpine
  • GraphicsMagick Version: GraphicsMagick 1.3.35 2020-02-23 Q16
  • Ghostscript Version: 9.50

Originally posted by @kirito286 in #665 (comment)

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

No branches or pull requests

1 participant