joaquim
asked on
A lot of graphics in one file
Hi, people! Expert Exchange rulz! Delphi RULZ!!
well, i need some help from you.
I want to create a file (just one) with pictures (TJPEG) and later, read the file and view each graphic. Example:
var
TamGraph: Word;
Graphic: TFileStream;
GFile: TFilestream;
begin
If OpenPictureDialog1.Execute then
begin
Graphic := TFileStream.Create (OpenPictureDialog1.Filena me);
GFile := TFileStream.Create ('test.dat', fmCreate);
TamGraph := Word (Graphic.Size);
GFile.Write (TamGraph, SizeOf(TamGraph));
GFile.CopyFrom (Graphic, TamGraf);
etc etc etc
end;
Well, when I try to load one of these graphics (using Streams), I allways get a error message. Example:
var
TamGraph: Word;
TempGraph: TMemoryStream;
begin
TempGraph := TMemoryStream.Create;
GFile.Seek (0, soFromBeginning);
GFile.Read (TamGraph, SizeOf(TamGraph));
TempGraph.SetSize (TamGraph);
TempGraph.CopyFrom (GFile, TamGraph);
Image1.Picture.Graphic.Loa dFromStrea m (TempGraph);
{Here a error occurs. I tried too:}
TJpegImage(Image1.Picture) .LoadFromS tream (TempGraph);
{Another error}
end;
What can I do?
Please note: The graphic is a Jpeg Image, a put JPEG on uses etc etc. Please, help me!!!
thanks, people!
Joaquim
well, i need some help from you.
I want to create a file (just one) with pictures (TJPEG) and later, read the file and view each graphic. Example:
var
TamGraph: Word;
Graphic: TFileStream;
GFile: TFilestream;
begin
If OpenPictureDialog1.Execute
begin
Graphic := TFileStream.Create (OpenPictureDialog1.Filena
GFile := TFileStream.Create ('test.dat', fmCreate);
TamGraph := Word (Graphic.Size);
GFile.Write (TamGraph, SizeOf(TamGraph));
GFile.CopyFrom (Graphic, TamGraf);
etc etc etc
end;
Well, when I try to load one of these graphics (using Streams), I allways get a error message. Example:
var
TamGraph: Word;
TempGraph: TMemoryStream;
begin
TempGraph := TMemoryStream.Create;
GFile.Seek (0, soFromBeginning);
GFile.Read (TamGraph, SizeOf(TamGraph));
TempGraph.SetSize (TamGraph);
TempGraph.CopyFrom (GFile, TamGraph);
Image1.Picture.Graphic.Loa
{Here a error occurs. I tried too:}
TJpegImage(Image1.Picture)
{Another error}
end;
What can I do?
Please note: The graphic is a Jpeg Image, a put JPEG on uses etc etc. Please, help me!!!
thanks, people!
Joaquim
How about using the JPEG stream? In D3 you must install it yourself (check http://www.inprise.com/devsupport/delphi/ti_list/TI3333.html), in D4 it is included with the install..
Oops, it seems like you allready are using it, sorry.. Then, have you checked the example under HELP\Examples\JPEG ?
joaquim,
I don't work with JPEG (yet). But your sources look correct. So perhaps you should try to do the same with a simple bitmap instead of a JPEG, just to check whether the problem is in your file operations or in the JPEG operations...
Regards, Madshi.
I don't work with JPEG (yet). But your sources look correct. So perhaps you should try to do the same with a simple bitmap instead of a JPEG, just to check whether the problem is in your file operations or in the JPEG operations...
Regards, Madshi.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you all for the help!