6

I'm trying to render a HTML page as a 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 have also tried enabling the format parameter.

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

But the images are always showing colored noise like this. I am using the latest binaries from http://wkhtmltopdf.org/downloads.html.

enter image description here

Bornfree
  • 868
  • 7
  • 21

3 Answers3

2

Have you tried to increase the size of the image? I had such problem too with 100px images, but when I made width 500px I got no noise.

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

Eugene
  • 905
  • 1
  • 10
  • 22
0

We get the same issue.

Without the crop values it seems to work.

We are under:

  • Windows
  • Xammp
  • wkhtmltoimage 0.12.4 (with patched qt)

Our possible solution is to make the browser of the wkhtmltoimage width height 300px and width 210px:

/usr/local/bin/wkhtmltoimage-amd64 --transparent --height 300 --width 210 temporary.html image.png 
oaragones
  • 1
  • 2
0

The solution I figured out through trial-and-error is to set the width to something rather large. In my case, I set it to 8000. It apparently only uses the width as a guideline, so this theoretically should be a safe solution.

TBrenner
  • 1,151
  • 2
  • 9
  • 8