How do I reliably get an image dimensions in .NET without loading the image?

You can just use Image.FromStream(Stream, bool, bool) with “false” 2nd and 3rd parameter to avoid loading file into memory.

Leave a Comment