in thumbnails4j-core/src/main/java/co/elastic/thumbnails4j/core/ThumbnailUtils.java [199:204]
public static BufferedImage clipHtmlToImage(byte[] htmlBytes, Dimensions dimensions){
JEditorPane htmlComponent = new JEditorPane("text/html", new String(htmlBytes, StandardCharsets.UTF_8));
Dimension preferredSize = htmlComponent.getPreferredSize();
htmlComponent.setSize(preferredSize.width, preferredSize.height);
return htmlToImage(htmlComponent, dimensions);
}