Solved

bitmap.savetostream  problems.

Posted on 2000-04-27
8
696 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

734 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