COnvert your png images to jpeg with this typescrpt function. To use it i the browser, first compile it to typescript. Note that it won't work in a node.js environment because it relies on the DOM