function wrapNodeCanvasMethod(ctx, name) {
  const prev = ctx[name];
  ctx[name] = function (image) {
    const impl = idlUtils.implForWrapper(image);
    if (impl) {
      arguments[0] = impl._image || impl._canvas;
    }
    return prev.apply(ctx, arguments);
  };
}