migration from https://code.google.com/p/java-html2image/