def document_to_pixels(document):
    """Render an HTML document to PNG, check its size and return pixel data."""
    image = Image.open(io.BytesIO(document.write_png()))
    return image.width, image.height, image.getdata()
Render an HTML document to PNG, check its size and return pixel data.
tests/draw/__init__.py