How to get image size from base64
in C#?
Is it possible to do at all?
How to get image size from base64
in C#?
Is it possible to do at all?
Not directly as it depends on what data/format is encoded in the Base64 string. A rough approach would be (code not tested):
byte[] image = Convert.FromBase64String("Your Base64 string here");
using (var ms = new MemoryStream(image))
{
Image img = Image.FromStream(ms);
return new Tuple<int, int>(img.Width, img.Height); // or some other data container
}
Note: Image class comes from System.Drawing
.
See also the MSDN System.Drawing.Image class' documentation documentation.