Solved

bitmap.savetostream  problems.

Posted on 2000-04-27
8
686 Views
Last Modified: 2010-04-04
i have a bitmap and when i do this:

bitmap.SaveToFile('c:\1\2.bmp');
Bitmap.SaveToStream(Stream);
bitmap.LoadFromStream(stream);
bitmap.SaveToFile('c:\1\3.bmp');

2.bmp <> 3.bmp   why?  What should i do to correct this?
(d5 pro)
0
Comment
Question by:God_Ares
  • 4
  • 3
8 Comments
 
LVL 10

Accepted Solution

by:
Lischke earned 50 total points
ID: 2758394
Hi God_Ares, I assume the first entry in your list should be a LoadFromFile. What you need to keep in mind too is to rewind your stream:

bitmap.LoadFromStream('c:\1\2.bmp');
OldPosition := Stream.Postition;
Bitmap.SaveToStream(Stream);
Stream.Position := OldPosition;
bitmap.LoadFromStream(stream);
bitmap.SaveToFile('c:\1\3.bmp');

Ciao, Mike
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2758396
..hehe and I wrote it wrong too. The first line still should be

bitmap.LoadFromFile('c:\1\2.bmp');

Ciao, Mike
0
 
LVL 7

Author Comment

by:God_Ares
ID: 2758398
Edited text of question.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 7

Author Comment

by:God_Ares
ID: 2758405
k i'll test it when i'm back home,  i don't have delphi @work  :(
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2758411
And now? Will you give any comment? Even if you store the bitmap in the first line it is still needed to rewind the stream before you can read what you wrote before...

Ciao, Mike
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2758413
Oops, eMail crossing :-)

Ciao, Mike
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2760263
God Ares,
  I am guessing that after the SaveToStream, you need to to do a seek to set the pointer back to the beginning of the stream. For Example:


bitmap.SaveToFile('c:\1\2.bmp');
Bitmap.SaveToStream(Stream);
Stream.Seek(0,0);
bitmap.LoadFromStream(stream);
bitmap.SaveToFile('c:\1\3.bmp');


Try this and lemme know how you make out, okay?

Good luck!!
0
 
LVL 7

Author Comment

by:God_Ares
ID: 2763406
Lischke thank you for your awnser

DrDelphi thank you 2, but Lischke gave me the same...
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question