code: function (format) {
          if (!this.image || !this.size) return null;
  
          format = format || "image/png";
          var canvas = document.createElement("canvas");
          var context = canvas.getContext("2d");
          context.canvas.width = this.size.w;
          context.canvas.height = this.size.h;
  
          var imgData = context.createImageData(this.size.w, this.size.h);
          for (var i = 0; i < this.image.length; i++) {
              imgData.data[i] = this.image[i];
          }
          context.putImageData(imgData, 0, 0);
          
          return canvas.toDataURL(format);
      }
docs: Method: toImageUrl
  Create data URL from the snapshot image