diff --git a/browser.js b/browser.js index c0a7b9fa8..3077111ca 100644 --- a/browser.js +++ b/browser.js @@ -18,9 +18,9 @@ exports.createImageData = function (array, width, height) { } } -exports.loadImage = function (src) { +exports.loadImage = function (src, options) { return new Promise((resolve, reject) => { - const image = document.createElement('img') + const image = Object.assign(document.createElement('img'), options) function cleanup () { image.onload = null diff --git a/types/index.d.ts b/types/index.d.ts index e190da16e..8cc1708ee 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -294,7 +294,7 @@ export function createImageData(width: number, height: number): ImageData * @param src URL, `data: ` URI or (Node.js only) a local file path or Buffer * instance. */ -export function loadImage(src: string|Buffer): Promise +export function loadImage(src: string|Buffer, options?: any): Promise /** * Registers a font that is not installed as a system font. This must be used