Reply-To: "Joe C. Hecht" From: "Joe C. Hecht" Newsgroups: borland.public.delphi.graphics References: <3ad1c9c0_2@dnews> <3ad1dba1_2@dnews> Subject: Re: Extracting size info from Bitmap Date: Mon, 9 Apr 2001 13:47:12 -0500 Lines: 30 Organization: Joe Hecht Associates X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 24.17.126.157 Message-ID: <3ad203ab$1_1@dnews> X-Trace: dnews 986842027 24.17.126.157 (9 Apr 2001 11:47:07 -0700) Path: dnews Xref: dnews borland.public.delphi.graphics:37141 > This should work for a BMP: > procedure TForm1.Button1Click(Sender: TObject); > VAR > FileStream: TFileStream; > InfoHeader: TBitmapInfoHeader; >... > FileStream.Seek(SizeOf(TBITMAPFILEHEADER), soFromBeginning); > FileStream.Read(InfoHeader, SizeOf(InfoHeader)); This code will work only under some circumstancs. Of course, it is best to read the file header to check to see if the file is a bitmap file Next (and most important), a bitmapinfoheader does not always follow the file header. In fact, it is perfectly legal for a bitmapcoreheader structure to be there, and in that case, you just shot yourself in the foot, since the structures are very different. it is best to read the dword following the file header to determine the size of the structure (and thus determine the type of the structure). Joe -- Charity auction item: Jimmy Page autographed tourbook: http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=1422263137 Proceeds go to the Action for Brazillian Childrens Trust John Kaster is cycling to cure cancer! Lets help him out! http://homepages.borland.com/jkaster/tnt/