[memo] [draft] SVGCompiler (svgcompiler.com)


SVGCompiler is SVG element scraping as a service. It programmatically compiles SVG elements of a page. For example, to stand-alone PNG files.

SVG is a markup language for rending vector graphics. Vector graphics allows images to scale infinitely without loss of resolution since the market defines image without reference to pixel dimensions.

While SVG is excels at rendering images that are responsive to the device and region being rendered into, they are not easy to handle as independent image files. For this, it is often more convenient to “scrape” the rendered SVG into a stand-alone bitmap image file in a format such as PNG or JPG. Unlike JPG, PNG format is loss-less and has a transparent background, so is higher quality and more useful. Therefore, we only support PNG format.


A data graphics developer, possibly using D3JS, creates SVG images for interactively visualizing data. Sometimes he needs a static, easily embeddable, bitmap of those images. This is the case for promotional content, or other forms of marketing communications.


Because these images are generally embedded in a webpage, they have to be captured in situ. This is analogous to taking a snapshot a region of your computer screen using the operating system screenshot command and mouse to select the region.

The problem we are facing is how to do this programmatically, and at scale.


The process for scraping an SVG image is:

  • Load the image
  • Size the image to adjust the number of pixels being captured
  • Select the region to be scraped
  • Scrape the image
  • Upload the image file to some specified cloud storage


The SVGCompiler console will provide tools for composing GC API calls. It will contain a log of all images scrape and a link to their files.

The API calls will allow the programmer to specify the following values:

  • URL of a page containing the image
  • Selector of the element containing the image
  • Viewport of the image
  • Pixel width of the image
  • Name of the image file
  • Destination for the image file
  • Credentials for the destination


SVGCompiler will generate profits by charging customers for the number of chart PNGs scraped per month.