image-parser is a JavaScript library designed for parsing and basic manipulation of images. It primarily leverages `lwip` for image processing, with a mentioned fallback to GraphicsMagick, though the direct integration of GraphicsMagick is not clearly detailed in the quickstart. The current stable version is 1.2.9, with recent releases focusing on documentation updates and maintainer support links rather than feature development. This indicates the project is in a maintenance mode. A key characteristic is its reliance on `lwip`, a library that itself has seen limited maintenance and can present challenges with newer Node.js versions or platform compatibility due to its native dependencies. It allows for parsing image data, accessing individual pixels, resizing, cropping, and saving images.
npm install image-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to parse an image from a URL, retrieve its dimensions and pixel data, then resize it and save the modified image to a local file.
Consider using modern, actively maintained alternatives like `sharp` or `jimp` for new projects or if encountering installation issues. If you must use `image-parser`, ensure you are on an older, compatible Node.js version and that necessary system libraries for `lwip` compilation are installed.
For new development, evaluate actively maintained image processing libraries such as `sharp` or `jimp`, which offer better performance, broader platform support, and more robust feature sets.
Ensure your Node.js version is compatible with `lwip` (typically older versions like Node.js 10 or 11 are more stable for `lwip`). Install necessary system-level build tools (e.g., `build-essential` on Linux, Xcode command line tools on macOS, Visual Studio build tools on Windows). Try reinstalling with `npm rebuild` or `npm install --unsafe-perm`.
Use the CommonJS `require` syntax: `const ImageParser = require('image-parser');`.