async function imageFromResponse(response) {
  const blob = await response.blob();

  return new Promise((resolve, reject) => {
    const image = new Image();
    const blobUrl = URL.createObjectURL(blob);
    image.onload = () => {
      URL.revokeObjectURL(blobUrl);
      resolve(image);
    };
    image.onerror = () => {
      URL.revokeObjectURL(blobUrl);
      reject(new Error('Failed to load image'));
    };
    image.src = blobUrl;
  });
}
Get a loaded image given a response.

@param {Response} response The response.
@return {Promise<HTMLImageElement>} The image.