Get dimensions from Base64 encoded image

Viewed 6912

I have an Angular application where i need the dimensions of an Base64 encoded image. I have tried to load it into an Image but it just says it is 0x0

const image = new Image();
image.src = 'data:image/jpeg;base64,someBase64ImageString';

console.log(image.width + 'x' + image.height);

I cannot figure out how to get this information.

2 Answers
Related