eigc
v1.1.0
Published
Elite India Graphics Converter - A powerful Node.js native add-on for comprehensive image and document conversion. Requires Java Runtime Environment (JRE 8+).
Maintainers
Readme
EIGC - Elite India Graphics Converter
[: Version 8 or higher ⚠️ REQUIRED
- Memory: 2GB available RAM (4GB recommended)
- Storage: 500MB free space (for package + temp files)
About Dependencies
- NPM Dependencies: None (shows as "deps: none" on NPM)
- System Dependencies: Java Runtime must be installed separately
- Bundled Libraries: All Java libraries (~63MB) are included in the package
- No Additional Downloads: Everything needed is bundled except Java Runtime
Supported Platforms
- Windows: x64, arm64
- macOS: x64, arm64 (Intel & Apple Silicon)
- Linux: x64, arm64ds.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
EIGC is a powerful Node.js native add-on for comprehensive image and document conversion. Convert HTML to images, rasterize graphics, vectorize images, and transform between multiple formats with enterprise-grade performance.
⚠️ IMPORTANT: This package requires Java Runtime Environment (JRE 8+) to be installed on your system. Java libraries are included in the package.
🚀 Features
- ✅ HTML to Raster: Convert websites and HTML files to high-quality images (PNG, JPG, WEBP)
- ✅ Raster to SVG: Vectorize raster images with advanced tracing algorithms
- ✅ SVG to Raster: Render SVG graphics to pixel-perfect raster images
- ✅ Format Conversion: Transform between PNG, JPG, WEBP, and other formats
- ✅ Chrome Integration: Pixel-perfect website screenshots using headless Chrome
- ✅ High Performance: Native C++ module with Java integration for speed
- ✅ Cross Platform: Works on Windows, macOS, and Linux
📦 Installation
⚠️ Prerequisites
Java Runtime Environment (JRE 8+) is REQUIRED - EIGC will not work without Java installed.
Install Java First:
macOS:
# Using Homebrew (recommended)
brew install openjdk@17
# Or download from: https://adoptium.net/Linux (Ubuntu/Debian):
# Install OpenJDK
sudo apt-get update
sudo apt-get install openjdk-17-jre
# Verify installation
java -versionWindows:
- Download Java from Adoptium
- Install and add to PATH
- Verify with
java -versionin Command Prompt
Install EIGC
npm install eigcVerify Installation
const EIGC = require('eigc');
const converter = new EIGC();
console.log('✅ EIGC installed successfully!');What's Included
- ✅ Native C++ module (eigc.node)
- ✅ JavaScript API wrapper
- ✅ TypeScript definitions
- ✅ Java libraries (63MB) - bundled in package
- ✅ Complete documentation
🔧 Quick Start
Basic Setup
const EIGC = require('eigc');
// Initialize converter
const converter = new EIGC();
// Set Chrome Driver version (required for HTML conversions)
EIGC.GOOGLE_CHROME_DRIVER_VERSION = "130.0.6723.58";Convert Image to SVG
async function convertToSvg() {
try {
await converter.rasterToSvg({
input: "./photo.png",
output: "./vector.svg",
scale: "1.0",
colorReduction: "64"
});
console.log("✅ Image converted to SVG!");
} catch (error) {
console.error("❌ Conversion failed:", error.message);
}
}
convertToSvg();Convert Website to Image
async function screenshotWebsite() {
try {
await converter.htmlToRaster({
input: "https://example.com",
output: "./screenshot.png",
width: "1920",
height: "1080",
dpi: "300"
});
console.log("✅ Website screenshot saved!");
} catch (error) {
console.error("❌ Screenshot failed:", error.message);
}
}
screenshotWebsite();📖 API Reference
Available Methods
rasterToSvg(options)
Convert raster images (PNG, JPG, etc.) to SVG vector graphics.
await converter.rasterToSvg({
input: "./image.png", // Input image file
output: "./vector.svg", // Output SVG file
scale: "1.0", // Scaling factor (optional)
colorReduction: "64" // Number of colors (optional)
});htmlToRaster(options)
Convert HTML content or websites to raster images.
await converter.htmlToRaster({
input: "https://example.com", // URL or HTML file path
output: "./screenshot.png", // Output image file
width: "1920", // Image width (optional)
height: "1080", // Image height (optional)
dpi: "300" // Resolution (optional)
});svgToRaster(options)
Convert SVG graphics to raster images.
await converter.svgToRaster({
input: "./vector.svg", // Input SVG file
output: "./image.png", // Output image file
format: "png", // Output format
width: "800", // Output width
height: "600" // Output height
});rasterToRaster(options)
Convert between different raster image formats.
await converter.rasterToRaster({
input: "./image.png", // Input image file
output: "./image.jpg", // Output image file
format: "jpg", // Output format
quality: "0.9" // Compression quality (optional)
});💡 Examples
Complete Example
const EIGC = require('eigc');
async function main() {
const converter = new EIGC();
// Set Chrome driver version for HTML conversions
EIGC.GOOGLE_CHROME_DRIVER_VERSION = "130.0.6723.58";
try {
// Convert image to SVG
await converter.rasterToSvg({
input: "./photo.png",
output: "./vector.svg",
colorReduction: "32"
});
// Convert website to image
await converter.htmlToRaster({
input: "https://example.com",
output: "./website.png",
width: "1200",
height: "800"
});
console.log("✅ All conversions completed!");
} catch (error) {
console.error("❌ Error:", error.message);
}
}
main();Batch Processing
const images = ["photo1.png", "photo2.png", "photo3.png"];
for (const image of images) {
await converter.rasterToRaster({
input: `./input/${image}`,
output: `./output/${image.replace('.png', '.jpg')}`,
format: "jpg",
quality: "0.9"
});
}�️ Troubleshooting
Common Issues
"Java not found" or "JVM initialization failed"
# Check if Java is installed
java -version
# Install Java if missing (macOS)
brew install openjdk@17
# Install Java if missing (Ubuntu/Debian)
sudo apt-get install openjdk-17-jre"Chrome Driver version mismatch" (for HTML conversions)
// Update Chrome Driver version to match your browser
EIGC.GOOGLE_CHROME_DRIVER_VERSION = "130.0.6723.58";
// Check your Chrome version:
// Chrome -> About Google ChromeModule installation issues
# Clear NPM cache and reinstall
npm cache clean --force
rm -rf node_modules package-lock.json
npm install eigcRequirements
- Node.js: 14.0.0 or higher
- Java: JRE 8 or higher (required)
- Memory: 2GB available RAM
- Storage: 500MB free space
🆘 Support
- 🐛 Issues: Report bugs
- � Email: [email protected]
- � NPM: View package
📄 License
MIT License - see the LICENSE file for details.
� Author
Saleem Ahmad - Elite India
⭐ Star this project if it helps you! | � Available on NPM
