diff --git a/packages/core/src/utils/image-bitmap.js b/packages/core/src/utils/image-bitmap.js index 6b2717d11..fe377cbd9 100644 --- a/packages/core/src/utils/image-bitmap.js +++ b/packages/core/src/utils/image-bitmap.js @@ -225,7 +225,15 @@ export function getBuffer(mime, cb) { if (this.constructor.encoders[mime]) { const buffer = this.constructor.encoders[mime](this); - cb.call(this, null, buffer); + // Typically, buffers return a string or map. However, the gif library "gifwrap" seemingly returns promises. + if (buffer instanceof Promise) { + // trigger the callback when the promise has been resolved + buffer.then((buff) => { + cb.call(this, null, buff); + }); + } else { + cb.call(this, null, buffer); + } } else { return throwError.call(this, "Unsupported MIME type: " + mime, cb); }