program Proga2;

uses  Windows, Classes, sysUtils, graphics;

type
Thead=record
count:integer;
name:string[5];
tcl:tcolor;
end;

var fs:tfilestream;
size:int64;
h:thead;
i:integer;
m:Tmemorystream;
begin
fs:=tfilestream.Create(paramstr(1),fmOpenRead);
fs.read(h,sizeof(h));
for i:=0 to h.count-1 do
begin
fs.Read(size,sizeof(Size));
m:=Tmemorystream.Create;
m.Position:=0;
m.CopyFrom(fs,size);
if i<10 then
m.SaveToFile(h.name+'00'+inttostr(i)+'.bmp');
if (i>9)and(i<100) then
m.SaveToFile(h.name+'0'+inttostr(i)+'.bmp');
if i>99 then
m.SaveToFile(h.name+inttostr(i)+'.bmp');
m.Free;
end;
fs.Free;
end.
