При помощи данной процедуры на Delphi можно узнать высоту и ширину картинки, сохраненной в формате PNG:
function ReadMWord (f:TFileStream):word; type TMotorolaWord = record case byte of 0:(Value:word); 1:(Byte1, Byte2:byte); end; var MW: TMotorolaWord; begin f.Read(MW.Byte2, SizeOf(Byte)); f.Read(MW.Byte1, SizeOf(Byte)); Result := MW.Value; end; procedure GetPNGSize(const sFile: String; var wWidth, wHeight: Word); type TPNGSig=array[0..7] of byte; const ValidSig:TPNGSig=(137, 80, 78, 71, 13, 10, 26, 10); var Sig: TPNGSig; f: tFileStream; x: Integer; begin FillChar(Sig, SizeOf(Sig), #0); f:=TFileStream.Create(sFile, fmOpenRead); try f.Read (Sig[0], SizeOf(Sig)); for x:=Low (Sig) to High(Sig) do if (Sig[x]<>ValidSig[x]) then exit; f.Seek (18, 0); wWidth := ReadMWord (f); f.Seek(22, 0); wHeight := ReadMWord(f); finally f.Free; end; end;