I am not sure it\'s even possible but - can I get the image file size from data URI?
For example, let\'s say there is an IMG element where src goes:
Your best option is to calculate the length of the base64 string itself.
What is a base64 length in bytes?
You have to convert the base64 string to a normal string using atob() and then check it length, it will return a value that you can say is close to the actual size of the image. Also you don't need the data:image/jpeg;base64, part from the data URI to check the size.