How to save .skp files from Chromium

Skia pictures or ".skp's" are a binary format for the draw commands Chromium sends to Skia for rasterization. You can view and export these files from Chrome's about:tracing tool to view them in the Skia debugger.
  1. Grab Chrome Canary or a tip-of-tree Chromium Release build and launch it with the following flags (for help, see [1]):
    --enable-threaded-compositing --force-compositing-mode --enable-impl-side-painting --enable-skia-benchmarking --allow-webui-compositing  
  2. Navigate to "about:tracing".

     
  3. Open a new tab and navigate to your favorite knitting website.


  4. Go back to the about:tracing tab and press record. Check “cc” and “Disabled by default cc.debug”. Uncheck everything else for this demo, then press record.



  5. Go back to your knitting webpage and refresh the page. You can scroll around, select text, etc (each generated skpicture will be saveable).

  6. Go back to “about:tracing” and press “stop tracing”.

  7. Now for some fun! Use the W, A, S, and D keys like you’re playing a video game. Your goal in this game is to find the “cc::Picture” dot that you’d like to save. When you’ve found the one, click “Save SkPicture”. Note: you can use the left and right arrow keys to cycle through cc::Pictures. You may notice there are two copies of most pictures--this is for low resolution (first) and high resolution (second).


  8. You can now open this picture in the Skia debugger.



[1] How to launch Chrome with flags on OSX
Chrome Canary can be launched with:
./Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --enable-threaded-compositing --force-compositing-mode --enable-impl-side-painting --enable-skia-benchmarking --allow-webui-compositing
If you build yourself, make sure to use a Release build and launch with:
./out/Release/Chromium.app/Contents/MacOS/Chromium --enable-threaded-compositing --force-compositing-mode --enable-impl-side-painting --enable-skia-benchmarking --allow-webui-compositing

Comments