How to show jpg image from MemoryStream

November 28th, 2006 By krastev

If you want to present jpg image from Memorystream you can use this procedure in Delphi:

procedure TfmMain.ShowImage(ImageName:String; ImageStr:TMemoryStream; var Image:TImage);

var Graphic:TGraphic;

ImageType:String;

begin

if ImageStr.Size <= 1 then

Exit;

try

ImageType := UPPERCase(ExtractFileExt(ImageName));

if (ImageType = '.JPG') OR (ImageType = '.JPEG') then

graphic := TJpegImage.Create;

ImageStr.Position := 0;

graphic.LoadFromStream(ImageStr);

Image.Picture.Assign(graphic);

finally

graphic.Free;

end;

end;

Last 5 posts by krastev

Popularity: 32% [?]

Leave a Reply

You must be logged in to post a comment.

Exchange.bg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[ top of the page ]

BG Flag UK Flag
website design e-commerce dynamic database websites