Is it a Bitmap or MetaFile?

306 Views Asked by At

Given a Stream that I know will be a picture, is there a way to programmatically determine if it is a Bitmap or a MetaFile when pulled from Image.FromStream(mystream)? Like a flag or something.

Environment: .NET, System.Drawing, C#/VB

2

There are 2 best solutions below

1
Mark Cidade On BEST ANSWER
0
Subhash Lama On

I think, by reading the first few bytes one sould be able to identify. LIke II* are the byes in tiff file. ‰PNGin png, BM in bmp files