Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 09-12-2002, 10:46 PM
3homer
Guest
 
Posts: n/a
Default Jpg to Stream ,and Stream to Bmp ... Fail ? why

image1(link to a jpg)

i use image1.picture.bitmap.writetostream(m);

an use image2.picture.bitmap.loadfromstream(m);

but fail why?




~3homer~
Thanx,very much.
Reply With Quote
  #2  
Old 09-12-2002, 11:59 PM
andyho andyho is offline
Senior Member
 
Join Date: Jul 2001
Posts: 1,446
Default RE: Jpg to Stream ,and Stream to Bmp ... Fail ? why

Writing the JPEG into the stream fails because the JPEG is not available as bitmap (bitmap is only available if the image contains a BMP), but as graphic:

image1.picture.graphic.savetostream()

Loading a bmp from stream is only working in your code if there is already something in bitmap - but if you have a JPEG inside that image before it will fail. Then you have to do like this:

var
h: TBitmap;
begin
h:=NIL;
try
h:=TBitmap.Create;
h.loadfromstream(m);
image1.picture.graphic.assign(h);
finally
h.free;
end;
end;


Bye,
Andy

If it helped please click accept...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 06:33 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.