Skip to content

Instantly share code, notes, and snippets.

@c7x43t
Created August 25, 2021 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c7x43t/2b27ddb6e84ebebe2e069c0c6332f620 to your computer and use it in GitHub Desktop.
Save c7x43t/2b27ddb6e84ebebe2e069c0c6332f620 to your computer and use it in GitHub Desktop.
https://stackoverflow.com/questions/48011613/rendering-webgl-image-in-headless-chrome-without-a-gpu
(function(){
var __getContext=HTMLCanvasElement.prototype.getContext;
Object.defineProperty(HTMLCanvasElement.prototype,'getContext',{
configurable: true,
enumerable: true,
value: function getContext(contextType, contextAttributes={}){
var options={
premultipliedAlpha: false
}
return __getContext.call(this,contextType,Object.assign({},contextAttributes,options))
},
writable: true
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment