News for hackers. Stuff that matters.
Re:IMGKit: Python library of HTML to IMG wrapper by NKCSS on Monday January 30, 2017 @10:12AM (#13521761)
What would be a good reason to use this over PhantomJS?
Re:IMGKit: Python library of HTML to IMG wrapper by pmlnr on Monday January 30, 2017 @11:46AM (#13522691)
As much as I despise the nodejs dependency hell, PhantomJS is a better solution when compared to wkhtml, so a Python-PhantomJS wrapper would be a significantly better product imho.
Re:IMGKit: Python library of HTML to IMG wrapper by tyingq on Monday January 30, 2017 @01:18PM (#13523633)
At least for screenshots, the headless support recently introduced into chrome might be the most straightforward solution, with the fewest pieces.

Some detail: https://docs.google.com/document/d/1VTcYz4q_x0f1O5IVrvRX4u1D...

Re:IMGKit: Python library of HTML to IMG wrapper by NKCSS on Monday January 30, 2017 @12:13PM (#13522969)
PhantomJS has stand-alone binaries that you can just call from Python if you wanted.
Re:IMGKit: Python library of HTML to IMG wrapper by hackerboos on Monday January 30, 2017 @01:18PM (#13523625)
That's all this project does.
Re:IMGKit: Python library of HTML to IMG wrapper by Keyframe on Monday January 30, 2017 @10:39AM (#13521998)
Python
Re:IMGKit: Python library of HTML to IMG wrapper by djm_ on Monday January 30, 2017 @10:18AM (#13521814)
If you wanted a different engine: Webkit.

Edit: I was mistaken, they both back to Webkit.

Re:IMGKit: Python library of HTML to IMG wrapper by NKCSS on Monday January 30, 2017 @10:26AM (#13521892)
PhantomJS is also WebKit...
Re:IMGKit: Python library of HTML to IMG wrapper by sunilkumarc on Monday January 30, 2017 @11:10AM (#13522324)
PhantomJS is a JavaScript API. This is a Python API.
Re:IMGKit: Python library of HTML to IMG wrapper by llccbb on Monday January 30, 2017 @10:55AM (#13522167)
Can this create/upsample an image to a specified resolution/zoom level? Say I want a 2000x5000 pixel image of the way a website looks when the window size is 400x1000.

I looked through the manual but didn't see explicit examples.

Re:IMGKit: Python library of HTML to IMG wrapper by dr_zoidberg on Monday January 30, 2017 @11:11AM (#13522330)
If it's jsut upsampling you could do that with PIL/Pillow, after saving the output image.
Re:IMGKit: Python library of HTML to IMG wrapper by minimaxir on Monday January 30, 2017 @11:12AM (#13522346)
Not if you want photos of how responsive layouts behave at higher resolutions.
Re:IMGKit: Python library of HTML to IMG wrapper by kevinwang on Monday January 30, 2017 @11:36AM (#13522595)
Which is why the parents specifically are just talking about upsampling the image, though
Re:IMGKit: Python library of HTML to IMG wrapper by llccbb on Tuesday January 31, 2017 @09:35AM (#13530832)
I want it rendered at the higher resolution, not upsampled from a lower-resolution image. Should have made that more clear.
Re:IMGKit: Python library of HTML to IMG wrapper by Jack0614 on Monday January 30, 2017 @11:44AM (#13522676)
You can see manual of wkhtmltoimage:)
Re:IMGKit: Python library of HTML to IMG wrapper by lyschoening on Monday January 30, 2017 @04:07PM (#13525020)
How well does this handle SVGs? I used PhantomJS for headless rendering before, but it didn't properly render SVG linear gradients.
Re:IMGKit: Python library of HTML to IMG wrapper by mertd on Monday January 30, 2017 @11:28AM (#13522507)
Does the text remain text or does it become an image?
Re:IMGKit: Python library of HTML to IMG wrapper by ziikutv on Monday January 30, 2017 @11:34AM (#13522578)
It creates an image. Think of it like taking a screenshot of the website.
Re:IMGKit: Python library of HTML to IMG wrapper by mertd on Monday January 30, 2017 @12:01PM (#13522842)
For the sake of preserving the structure, I'd prefer WeasyPrint.
Re:IMGKit: Python library of HTML to IMG wrapper by Jack0614 on Monday January 30, 2017 @11:38AM (#13522608)
Yes, you can make text become image
Re:IMGKit: Python library of HTML to IMG wrapper by parceltape on Monday January 30, 2017 @10:41AM (#13522017)
I think the title of this is a bit misleading. It is a wrapper lib around the cli of wkhtmltopdf (which the GitHub repo states).
Re:IMGKit: Python library of HTML to IMG wrapper by mschuster91 on Monday January 30, 2017 @10:43AM (#13522038)
Oh god. wkhtmltopdf sucks on so many levels, Webkit itself being one of them as their fork is totally outdated... sometimes I really think about rewriting it using Chromium Embedded Framework.
Re:IMGKit: Python library of HTML to IMG wrapper by hackerboos on Monday January 30, 2017 @01:17PM (#13523618)
You're better off using PhantomJS to take screenshots.

There's still no great solution for Flash if you have to support that. I did a lot of research on this previously.

Re:IMGKit: Python library of HTML to IMG wrapper by Jack0614 on Monday January 30, 2017 @11:41AM (#13522646)
I found there is no python API of this feature, so I wrote it, this lib is based on ruby pdfkit