How to Change a Bitmap size form delphi 3

How to Change a Bitmap size form delphi 3?
rmlohAsked:
Who is Participating?
 
viktornetConnect With a Mentor Commented:
Here it is...

To save a bitmap to a file you use SaveToFile() like this...

MyBitmap.SaveToFile(PutTheFileNameInHere);

to stretch the bitmap use StretchDraw();;;;here is an example....


var
  b : TBitmap;
begin
 b := TBitmap.Create;
 b.LoadFromFile('C:\windows\desktop\test.bmp');
 b.canvas.StretchDraw(rect(0, 0, b.width shl 1, b.height shl 1), b);
 b.SaveToFile('C:\windows\desktop\stretched.bmp');
 b.Free;
end;

This should work, if it doesn't let me know and I'll do it once again and will test it. If you are not satisfied with the answer please don't reject my answer and just tell me what more you need and I'll answer your questions...

-Viktor
--Ivanov
0
 
intheCommented:
if your using the timage component set the stretch property to true in object inspector if this gives unexceptable result i can post a unit for rescaling bitmaps
Regards Barry
0
 
viktornetCommented:
You just use

bmp.width := whatevervalue;
bmp.height := whatevervalue;

-Viktor
--Ivanov
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.

 
rmlohAuthor Commented:
I now how to do it i wont to save the image in my size to a
bmp file
0
 
viktornetCommented:
PLease explain yourself better next tim 'cuz I don't understand what ya mean...

Here is the way to save the bitmap....

MyBmp.SaveToFile(Filename);

-Viktor
--Ivanov
0
 
rmlohAuthor Commented:
No i wont to save a bitmap in my size
0
 
Oli2Commented:
I think, what rmloh is trying to say is:
He wants to change the size of a Bitmap and then save it to file with the new size.

Greetings, Oli
0
 
teechongCommented:
You can create a temporary TBitmap, copy the stretched image (of the source) over using CopyRect or the like then save the temporary TBitmap using the SaveToFile method.

TC
0
 
viktornetCommented:
rmloh, I think you don't know what you are talking about. The other question you asked is messed up the same way this one is,,, YOu don't explain and just reject answers/... If you are not satisfied with the answer you should ask for further help and not just reject the answer... if I don't supply further help you just reject it then.... NExt time you bettter explain your situation 'cuz and tired of people not explaining completly what they want...

-Viktor
0
 
rmlohAuthor Commented:
The anserr is excellant but can you pleas tell my how
to Stretch and save to file.
 
   
0
 
viktornetCommented:
Oh, I forgot, make sure that you have a bitmap named test.bmp on your desktop in order for this to work....

-Viktor
0
 
rmlohAuthor Commented:
ok ok
0
 
viktornetCommented:
Did it work?? If not just tell me what went wrong and I'll fix it.

-Viktor
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.