public Bitmap(int w, int h) { width = w; height = h; canvas = (CanvasElement) Document.GetElementById("canvas"); context = (CanvasRenderingContext2D) canvas.GetContext(CanvasContextId.Render2D); // "2d" context.GlobalCompositeOperation = CompositeOperation.Copy; // ### it was: CompositeOperation imagedata = context.CreateImageData(w,1); // w,h }