This sample shows how to use Diagram.makeImageData with the returnType: "blob" option and the necessary callback option.
returnType: "blob"
callback
Blobs may not be supported or work consistently on all browsers. This code was tested with Chrome, Firefox, IE11 and Edge.