Skip to content

[IN PROGRESS] A java library that turns your html into an image

License

Notifications You must be signed in to change notification settings

DuncteBot/html-to-image-java

Repository files navigation

Html to image java

A convenient library to convert your html into images

Examples:

Generating a simple image
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import com.dunctebot.htmltoimage.HtmlToImage;

public class Main {
    public static void main(String[] args) throws IOException {
        final byte[] bytes = HtmlToImage.htmlToPngBytes("<h1 style=\"background: green;\">hello world</h1>", 200, 200);

        try (FileOutputStream stream = new FileOutputStream(new File("image.png"))) {
            stream.write(bytes);
        }
    }
}

This code will generate the following image:

What the code generated

Changing the background color

About

[IN PROGRESS] A java library that turns your html into an image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published