I need to read the header information on an image (could be a .jpeg, .gif,
.bmp) and find the height and width. I know I can open it as a binary file,
and bump to the appropriate location where height and width is stored in the
header, but I was wondering if anyone knows of a slick way of using
System.Drawing utilities to do this?
Thanks for any help you can give me.
Morten Wennevik - 21 May 2005 00:52 GMT
Brian,
If you load it as a Bitmap (Image.FromFile) you can read the Bitmap dimensions afterwards. Otherwise you will have to read the headers by hand and decode the files yourself.
> I need to read the header information on an image (could be a .jpeg, .gif,
> .bmp) and find the height and width. I know I can open it as a binary file,
> and bump to the appropriate location where height and width is stored in the
> header, but I was wondering if anyone knows of a slick way of using
> System.Drawing utilities to do this?
> Thanks for any help you can give me.

Signature
Happy coding!
Morten Wennevik [C# MVP]
Lloyd Dupont - 21 May 2005 01:37 GMT
look at this sample application
http://www.windowsforms.net/Applications/application.aspx?PageID=50&tabindex=8
they modify image's header
>I need to read the header information on an image (could be a .jpeg, .gif,
> .bmp) and find the height and width. I know I can open it as a binary
[quoted text clipped - 4 lines]
> System.Drawing utilities to do this?
> Thanks for any help you can give me.