Skip to content

EIGC is a Java library offering powerful image & graphics conversion (HTML, raster, vector formats) via compiled JARs and full documentation.

Notifications You must be signed in to change notification settings

SaleemLww/EIGC-Java-Releases

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 EIGC Library (Elite India Graphics Converter)

Java Maven License Version

A powerful Java library for comprehensive image and graphics conversion between multiple formats including HTML, Raster, Vector (SVG), and more.

🎯 Architecture Overview

EIGC provides two ways to use the framework:

1. Eigc Main Class (Recommended) ⭐

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

2. Direct API Classes (Advanced)

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

πŸ“‹ Table of Contents

✨ Features

  • Unified API: Use the Eigc main 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 Eigc class for easy integration
  • Cross-Platform: Works on Windows, macOS, and Linux

πŸ”§ Requirements

  • Java: JDK 17 or higher
  • Maven: 3.8 or higher
  • Chrome Browser: Required for HTML to Raster conversion (WebDriver managed automatically)

πŸ“¦ Installation

Maven

Add the following dependency to your pom.xml:

<dependency> <groupId>com.elite.india.sa</groupId> <artifactId>EIGCLibrary</artifactId> <version>3.0-SNAPSHOT</version> </dependency>

Gradle

implementation 'com.elite.india.sa:EIGCLibrary:3.0-SNAPSHOT'

Manual Installation

  1. Clone the repository:
git clone git@github.com:SaleemLww/EIGC-Java.git cd EIGC-Java
  1. Build the project:
mvn clean install
  1. The JAR file will be available in the target directory.

πŸš€ Quick Start

Important: Use the Eigc class as the main entry point to access all framework functionalities!

Using the Eigc Main Class (Recommended)

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); } }

Direct API Usage (Alternative)

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(); } }

πŸ”„ Supported Conversions

Input Formats

  • HTML: Web pages and HTML files
  • Raster: PNG, JPEG, JPG, BMP, GIF, TIFF, TIF
  • Vector: SVG, EPS, PDF

Output Formats

  • Raster: PNG, JPEG, BMP, GIF, TIFF
  • Vector: SVG, EPS, AI, PDF
  • High-Quality: Support for custom DPI and resolution

πŸ’‘ Usage Examples

Using Eigc Main Class (Recommended Approach)

The Eigc class is the primary interface for all framework operations. It provides convenient methods for all conversion types.

HTML to Raster with Full Control

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); } }

Raster to Raster Conversion

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 );

Raster to SVG Conversion

Eigc eigc = new Eigc(); String result = eigc.rasterToSvg( "logo.png", // input file "logo.svg", // output file "1.0" // scale factor );

SVG to Raster Conversion

Eigc eigc = new Eigc(); String result = eigc.svgToRaster( "vector.svg", // input file "raster.png", // output file "1920", // width "1080", // height "96", // dpi "PNG" // format );

Raster to Vector (Multiple Formats)

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 );

SVG to Vector Conversion

Eigc eigc = new Eigc(); String result = eigc.svgToVector( "input.svg", // input file "output.eps", // output file "EPS" // format );

Using Direct API (Alternative Approach)

You can also use the individual converter classes directly for more control:

HTML to Raster with Custom Options

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();

Raster to Raster with Scaling

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();

Raster to Vector (Multiple Formats)

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();

SVG to Raster

SvgToRaster converter = new SvgToRaster.Builder() .inputFile(new File("vector.svg")) .outputFile(new File("raster.png")) .outputFormat("PNG") .width(1920) .height(1080) .build(); converter.convert();

Batch Processing

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(); } }

πŸ“š API Documentation

Full JavaDoc API documentation is available in the target/reports/apidocs directory after building the project.

To generate the documentation:

mvn javadoc:javadoc

Then open target/reports/apidocs/index.html in your browser.

Main Classes

  • Eigc ⭐ Main Entry Point - Unified facade providing convenient string-based methods for all conversions

    • htmlToRaster() - HTML to raster conversion
    • rasterToRaster() - Raster format transformation
    • rasterToSvg() - Raster to SVG conversion
    • svgToRaster() - SVG to raster conversion
    • rasterToVector() - Raster to multiple vector formats
    • svgToVector() - SVG to vector conversion
  • Direct API Classes (for advanced control):

    • HtmlToRaster: Convert HTML pages to raster images with builder pattern
    • RasterToRaster: Transform raster images between formats
    • RasterToVector: Convert raster images to vector formats
    • RasterToVectorHigh: High-quality raster to vector conversion
    • RasterToSvg: Specialized raster to SVG conversion
    • RasterToSvgEdges: Edge-detection based SVG conversion
    • RasterToSvgHigh: High-quality SVG output
    • SvgToRaster: Convert SVG to raster images
    • SvgToVector: Convert between vector formats
  • Utility Classes:

    • Dimensions: Utility class for dimension calculations
    • GlobalProperties: Global configuration properties
    • HtmlSizeUtil: HTML size calculation utilities

πŸ”¨ Building from Source

Prerequisites

  • JDK 17 or higher
  • Maven 3.8+
  • Git

Build Steps

# 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:javadoc

The compiled JAR will be available at target/EIGCLibrary-3.0-SNAPSHOT.jar

VS Code Setup

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.

πŸ§ͺ Testing

Run the test suite:

mvn test

Run specific tests:

mvn test -Dtest=YourTestClass

πŸ“ Configuration

Global Properties

Configure global settings using GlobalProperties class:

GlobalProperties.setProperty("key", "value"); String value = GlobalProperties.getProperty("key");

Log4j Configuration

Logging is configured via src/main/resources/log4j.properties. Customize logging levels and outputs as needed.

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please ensure your code:

  • Follows Java coding conventions
  • Includes appropriate JavaDoc comments
  • Passes all tests (mvn test)
  • Maintains backward compatibility

πŸ“„ License

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. 

πŸ‘€ Author

Saleem Ahmad
Elite India

🌟 Acknowledgments

This library uses the following open-source projects:

πŸ“Š Project Status

This project is actively maintained. Current version: 3.0-SNAPSHOT

Roadmap

  • 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

πŸ’¬ Support

For support, please:

  1. Check the API Documentation
  2. Review Usage Examples
  3. Search existing GitHub Issues
  4. Open a new issue if needed

πŸ“ˆ Statistics

GitHub stars GitHub forks GitHub watchers


Made with ❀️ by Elite India

Packages

No packages published