Wkhtmltoimage rendering color noise for transparent PNG

I am trying to display an HTML page as PNG with transparency enabled.

This is the command that generates the images:

/usr/local/bin/wkhtmltoimage-amd64 --transparent --crop-h 300 --crop-w 210 temporary.html image.png 

I also tried to enable the format option.

 /usr/local/bin/wkhtmltoimage-amd64 --transparent --format png --crop-h 300 --crop-w 210 temporary.html image.png 

But images always show color noises like this. I use the latest binaries from http://wkhtmltopdf.org/downloads.html .

enter image description here

+5
source share
3 answers

Have you tried to increase the image size? I also had a problem with 100 pixel images, but when I made a width of 500 pixels, I had no noise.

(Yes, I know this is not a complete solution, but maybe this will help someone)

0
source

We are getting the same problem.

Without crop values, it seems to work.

We are under:

  • for windows
  • Xammp
  • wkhtmltoimage 0.12.4 (with fixed qt)

Our possible solution is to create a browser with a width of whtmltoimage 300px and a width of 210px:

 /usr/local/bin/wkhtmltoimage-amd64 --transparent --height 300 --width 210 temporary.html image.png 
0
source

The solution that I found out by trial and error is to set the width to something rather large. In my case, I set it to 8000. Apparently, it uses only the width as a guide, so this should theoretically be a safe solution.

0
source

All Articles