-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Png images contain random noise pixels #2629
Comments
Note: This problem only occurs when generating images with a transparent background (using the --transparent option) |
Same issue: Image isn't loading, not sure why. Here is link: https://ramen-files.s3.amazonaws.com/email-images/a03fac7a-4c07-459c-94a3-6a5bb34d374e.png wkhtmltoimage 0.12.1 (with patched qt) |
Btw, this happens at 200x200, but not at 220x200. At 190x190, only the bottom ~20% of the image has noise. One of the odder bugs I've encountered. I only need PNGs, so I've moved over to a PhantomJS-based solution (https://github.com/ramen-dev/screencap) but still interested in this getting fixed for future PDF exports. |
+1 happens with me. Happens when one of the images on the page has a size > 800kb. |
+1 I'm getting this error when using both the |
What is the status of this issue? I have same issue and want to know how to solve it |
I've found a workaround for this! 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. |
Is this still an issue in 0.12.5? |
I was able to isolate the issue. Qt images are initialized with uninitialized data, as stated in -> http://doc.qt.io/qt-5/qimage.html#QImage-1 A line with "image.fill(qRgba(0, 0, 0, 0));" should be added after the initialization of the image to ensure that some data will always be on the background. This will fix issues with images with transparent background. |
Thank you franjaviersans ! I have just downoaded the latest version of wkhtmlimage and the bug is still there. thank you. |
Hello @Xhilbert I can give you the steps to build it, but I don't know how to upload the new version: The source code can be changed adding "image.fill(qRgba(0, 0, 0, 0));" in the line 182 of the file imageconverter.cc, after the creation of the image. To build the library the following steps should be used:
I only built it for that windows versions. There is the possibility to build with other platforms, but not all of them worked for me. Hope it helps. Let me know if you are able to build and upload a new version, as I'm currently using my modified version, but I would like to use the official version. |
Using your explanation, I was able to compile and release (a non official) a version with the correction of this ticket : https://github.com/Galigator/wkhtmltopdf/releases |
Thank you very much !!!! |
Thanks @Galigator, your release made my day! |
A fix for this still hasn't ended up in an official release? |
I use wkhtmltox-0.13.0-alpha-7b36694_linux-jessie-amd64 on Debian 8. Do you have a trick to fix this problem without compile from sources? Thanks! |
@flexeo #2629 (comment) I can confirm Brenner's comment works as a workaround. |
I still have this issue while croping the html to a 40px square to create a png icon. |
I am generating a small png image from a simple html file and the resulting png file contains random noise pixels in the first line of the image. All of the attached images were generated from the same exact html file using the command-line:
wkhtmltoimage.exe --transparent --javascript-delay 500 error.html error_out.png
The content of error.html file is as follows:
I'm using:
wkhtmltoimage 0.12.2.4 (with patched qt)
Windows 7 Professional SP 1 64-bit
The text was updated successfully, but these errors were encountered: