Thursday, May 27, 2004


khtml2png-like functionality using Webkit on OS X?


Lazyweb, I invoke thee. khtml2png is a clever little utility that uses the KHTML engine to render a snapshot of a webpage into small thumbnail image. I realize that I could probably get it to compile on OS X with a little sweat equity, but it’s got some fairly heavyweight dependencies and, theoretically, everything that one would need to do something similar on an OS X system is already there— between Webkit and Quartz, I don’t think there would be much standing in the way of a native implementation.

Am I right? Has someone already done this?


:: Dave Walker 12:13 (EST/EDT) [+]

:: [/tech/computers/os/osx]
:: tags:

:: Comments (6)

Comments:

Robert Sayre wrote:

Title:

Date:

Response:
I'm sure it can be done with just Cocoa.

Several WebKit classes subclass NSView, which has dataWithPDFInsideRect: and dataWithEPSInsideRect:. From there it would probably be some [NSImage initWithData] stuff.

pallih wrote:

Title:

Date:

Response:
Don´t know if you´re right and don´t know if it´s been done but i know it would be cool.

ssp wrote:

Title:

Date:

Response:

In a low-tech approach you could write an AppleScript that converts a PDF file to a PNG file using that new image scripting stuff.

Then you can set it up to be a PDF Workflow service and - sneaky ! - use UI scripting to invoke it from Safari (as Apple fails to provide a decent scripting interface for printing).


Title: Quartz Python bindings

Date:

Response:
This would be simple to do with the Quartz Python bindings; fax cover sheets in Panther are generated by a similar method.

Title: webkit2png

Date:

Response:
A couple of days back I promised to release the code i used to generate the weblog snapshots. I've finally tidied it up a bit and removed a load of crufty debugging code...

ssp wrote:

Title:

Date:

Response:
Have you seen this http://0x.se/paparazzi/ ? Might be what you're looking for. P.S. Your search field doesn't work.




The only promotion rules I can think of are that a sense of shame is to be avoided at all costs and there is never any reason for a hustler to be less cunning than more virtuous men. Oh yes ... whenever you think you've got something really great, add ten per cent more. -- Bill Veeck