Solved

bitmap.savetostream  problems.

Posted on 2000-04-27
8
687 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
Industry Leaders: 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

713 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