A powerful Java library for comprehensive image and graphics conversion between multiple formats including HTML, Raster, Vector (SVG), and more.
EIGC provides two ways to use the framework:
The com.elite.india.sa.eigc.Eigc class is the primary entry point that provides a unified, simplified API for all conversion operations. It uses string-based parameters for easy integration and is ideal for:
- Quick integrations
- Simple string-based parameter passing
- Unified interface for all conversions
- Less verbose code
Individual converter classes (HtmlToRaster, RasterToVector, etc.) with Builder pattern for advanced control and configuration. Ideal for:
- Fine-grained control over conversion parameters
- Type-safe parameter passing
- Advanced customization
- Direct access to conversion APIs
- Features
- Requirements
- Installation
- Quick Start
- Supported Conversions
- Usage Examples
- API Documentation
- Building from Source
- Contributing
- License
- Author
- Unified API: Use the
Eigcmain class for simplified access to all framework functionalities - HTML to Raster: Convert HTML pages to PNG, JPEG, BMP images using Selenium WebDriver
- Raster to Raster: Transform images between different raster formats with scaling and quality control
- Raster to Vector: Convert raster images to SVG, EPS, TIFF, AI, and PDF formats
- SVG to Raster: Render SVG graphics to raster images
- SVG to Vector: Convert between various vector formats
- High-Quality Output: Support for high-resolution output with customizable DPI settings
- Batch Processing: Process multiple images efficiently with multiple output formats
- Builder Pattern: Fluent API for easy configuration (when using direct API)
- String-based API: Simple string parameters via the
Eigcclass for easy integration - Cross-Platform: Works on Windows, macOS, and Linux
- Java: JDK 17 or higher
- Maven: 3.8 or higher
- Chrome Browser: Required for HTML to Raster conversion (WebDriver managed automatically)
Add the following dependency to your pom.xml:
<dependency>
<groupId>com.elite.india.sa</groupId>
<artifactId>EIGCLibrary</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>implementation 'com.elite.india.sa:EIGCLibrary:3.0-SNAPSHOT'- Clone the repository:
git clone git@github.com:SaleemLww/EIGC-Java.git
cd EIGC-Java- Build the project:
mvn clean install- The JAR file will be available in the
targetdirectory.
Important: Use the Eigc class as the main entry point to access all framework functionalities!
The Eigc class provides a unified interface for all conversion operations:
import com.elite.india.sa.eigc.Eigc;
public class Example {
public static void main(String[] args) {
// Initialize the EIGC framework
Eigc eigc = new Eigc();
// HTML to Raster conversion
String result = eigc.htmlToRaster(
"https://www.example.com", // input URL or file path
"output.png", // output file path
"1920", // width
"1080", // height
"96", // dpi
"true", // headless mode
"false", // incognito
"false", // multi-screen
"false", // long-screen
null, // current domain
null, // replacement domain
null, // script to inject
null, // css to inject
null, // html to inject
"5", // timeout
"false", // debug
null, // chrome driver version
null // crop area
);
System.out.println(result);
}
}You can also use the individual converter classes directly:
import com.elite.india.sa.HtmlToRaster;
import java.io.File;
public class Example {
public static void main(String[] args) throws Exception {
HtmlToRaster converter = new HtmlToRaster.Builder()
.url("https://www.example.com")
.outputFile(new File("output.png"))
.width(1920)
.height(1080)
.format("PNG")
.build();
converter.convert();
}
}- HTML: Web pages and HTML files
- Raster: PNG, JPEG, JPG, BMP, GIF, TIFF, TIF
- Vector: SVG, EPS, PDF
- Raster: PNG, JPEG, BMP, GIF, TIFF
- Vector: SVG, EPS, AI, PDF
- High-Quality: Support for custom DPI and resolution
The Eigc class is the primary interface for all framework operations. It provides convenient methods for all conversion types.
import com.elite.india.sa.eigc.Eigc;
public class Example {
public static void main(String[] args) {
Eigc eigc = new Eigc();
// Full-featured HTML to Raster conversion
String result = eigc.htmlToRaster(
"https://www.example.com", // input
"screenshot.png", // output
"1920", // width
"1080", // height
"96", // dpi
"true", // isHeadless
"false", // isIncognito
"false", // isMultiScreen
"true", // isLongScreen (capture full page)
null, // currentDomain
null, // replacementDomain
null, // scriptToInject
null, // cssToInject
null, // htmlToInject
"10", // timeout (seconds)
"false", // isDebug
null, // googleChromeDriverVersion
null // cropArea
);
System.out.println("Result: " + result);
}
}Eigc eigc = new Eigc();
String result = eigc.rasterToRaster(
"input.jpg", // input file
"output.png", // output file
"PNG", // format
"1.0", // scale factor
"0.95" // quality
);Eigc eigc = new Eigc();
String result = eigc.rasterToSvg(
"logo.png", // input file
"logo.svg", // output file
"1.0" // scale factor
);Eigc eigc = new Eigc();
String result = eigc.svgToRaster(
"vector.svg", // input file
"raster.png", // output file
"1920", // width
"1080", // height
"96", // dpi
"PNG" // format
);Eigc eigc = new Eigc();
String result = eigc.rasterToVector(
"photo.jpg", // input file
"output", // output base path
"SVG,EPS,PDF", // formats (comma-separated)
"1.5" // scale factor
);Eigc eigc = new Eigc();
String result = eigc.svgToVector(
"input.svg", // input file
"output.eps", // output file
"EPS" // format
);You can also use the individual converter classes directly for more control:
HtmlToRaster converter = new HtmlToRaster.Builder()
.url("https://www.example.com")
.outputFile(new File("screenshot.png"))
.width(1920)
.height(1080)
.format("PNG")
.waitTime(5) // Wait 5 seconds for page load
.headless(true) // Run in headless mode
.build();
converter.convert();RasterToRaster converter = new RasterToRaster.Builder()
.inputFile(new File("input.jpg"))
.outputFile(new File("output.png"))
.outputFormat("PNG")
.scaleFactor(2.0) // 2x scaling
.quality(0.95f) // 95% quality
.build();
converter.convert();RasterToVector converter = new RasterToVector.Builder()
.inputFile(new File("logo.png"))
.outputFile(new File("logo.svg"))
.outputFormat("SVG")
.scaleFactor(1.0)
.colorReduction(256) // Reduce to 256 colors
.build();
converter.convert();
// Convert to EPS
converter = new RasterToVector.Builder()
.inputFile(new File("logo.png"))
.outputFile(new File("logo.eps"))
.outputFormat("EPS")
.build();
converter.convert();SvgToRaster converter = new SvgToRaster.Builder()
.inputFile(new File("vector.svg"))
.outputFile(new File("raster.png"))
.outputFormat("PNG")
.width(1920)
.height(1080)
.build();
converter.convert();File inputDir = new File("input_images");
File outputDir = new File("output_vectors");
outputDir.mkdirs();
for (File inputFile : inputDir.listFiles()) {
if (inputFile.getName().endsWith(".png")) {
String outputName = inputFile.getName().replace(".png", ".svg");
RasterToVector converter = new RasterToVector.Builder()
.inputFile(inputFile)
.outputFile(new File(outputDir, outputName))
.outputFormat("SVG")
.build();
converter.convert();
}
}Full JavaDoc API documentation is available in the target/reports/apidocs directory after building the project.
To generate the documentation:
mvn javadoc:javadocThen open target/reports/apidocs/index.html in your browser.
-
Eigcβ Main Entry Point - Unified facade providing convenient string-based methods for all conversionshtmlToRaster()- HTML to raster conversionrasterToRaster()- Raster format transformationrasterToSvg()- Raster to SVG conversionsvgToRaster()- SVG to raster conversionrasterToVector()- Raster to multiple vector formatssvgToVector()- SVG to vector conversion
-
Direct API Classes (for advanced control):
HtmlToRaster: Convert HTML pages to raster images with builder patternRasterToRaster: Transform raster images between formatsRasterToVector: Convert raster images to vector formatsRasterToVectorHigh: High-quality raster to vector conversionRasterToSvg: Specialized raster to SVG conversionRasterToSvgEdges: Edge-detection based SVG conversionRasterToSvgHigh: High-quality SVG outputSvgToRaster: Convert SVG to raster imagesSvgToVector: Convert between vector formats
-
Utility Classes:
Dimensions: Utility class for dimension calculationsGlobalProperties: Global configuration propertiesHtmlSizeUtil: HTML size calculation utilities
- JDK 17 or higher
- Maven 3.8+
- Git
# Clone the repository
git clone git@github.com:SaleemLww/EIGC-Java.git
cd EIGC-Java
# Clean and compile
mvn clean compile
# Run tests
mvn test
# Package the library
mvn package
# Install to local Maven repository
mvn install
# Generate JavaDoc
mvn javadoc:javadocThe compiled JAR will be available at target/EIGCLibrary-3.0-SNAPSHOT.jar
This project is configured for Visual Studio Code with:
- Java Extension Pack
- Maven for Java
- Debugger for Java
Open the workspace file EIGC.code-workspace in VS Code for the best experience.
Run the test suite:
mvn testRun specific tests:
mvn test -Dtest=YourTestClassConfigure global settings using GlobalProperties class:
GlobalProperties.setProperty("key", "value");
String value = GlobalProperties.getProperty("key");Logging is configured via src/main/resources/log4j.properties. Customize logging levels and outputs as needed.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your code:
- Follows Java coding conventions
- Includes appropriate JavaDoc comments
- Passes all tests (
mvn test) - Maintains backward compatibility
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024-2025 Elite India
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Saleem Ahmad
Elite India
- GitHub: @SaleemLww
- Repository: EIGC-Java
This library uses the following open-source projects:
- Selenium WebDriver - Browser automation
- Apache PDFBox - PDF manipulation
- Apache Batik - SVG toolkit
- Apache FOP - Formatting objects
- JSoup - HTML parser
- WebDriverManager - WebDriver management
This project is actively maintained. Current version: 3.0-SNAPSHOT
- Support for more vector formats (AI, CDR)
- GPU acceleration for faster conversions
- REST API wrapper
- Command-line interface
- Docker support
- More image processing filters
- WebP format support
For support, please:
- Check the API Documentation
- Review Usage Examples
- Search existing GitHub Issues
- Open a new issue if needed