BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delphi sizof bmp jpg memory

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Brian Heemsbergen
Guest





PostPosted: Wed Oct 11, 2006 1:54 am    Post subject: Delphi sizof bmp jpg memory Reply with quote



I'm posting a complete code solution so the next former VB6 SLOB doesn't
have to Google so much. I'd have never gotten here with previous posts,
but man you Delphi people are TERSE! "Just load it into a
memorystream." How???????

If I forgot something like freeing memory, please advise.

BTW - I tested using a 200x400 pixel picture. The internal .jpg was
15,780 and the internal .bmp was 240,054. So a big savings. BUT, VB6
pads 24 bit color bitmaps to 32 bits so a 200x400 would be 320,000
(200x400x4). So my other routines will still need some work.

Brian

-----------------------

uses jpeg;

// in a proc

var
myBitMap : tbitmap;
myJPG : TJPEGImage;
myStream : TMemoryStream;

begin

// the easy way to actually load an image
// the rest is just to test the internal memory size
// imgSplash is a TImage put on the form from the Tool Palatte
//
// imgSplash.Picture.LoadFromFile ('Foyt1977SplashU.jpg');
// imgSplash.Picture.LoadFromFile ('Foyt1977Splash.bmp');

mystream := tmemorystream.Create;
myJPG := TJPEGImage.Create;
myJPG.LoadFromFile ('Foyt1977SplashU.jpg');
imgsplash.Canvas.Draw(0,0,myJPG); // just to see if loaded
myJPG.SaveToStream(myStream);
showmessage('Size of jpg = ' + inttostr(mystream.Size));
myJPG.Free;
mystream.Free;

mystream := tmemorystream.Create;
mybitmap := TBitMap.Create;
mybitmap.LoadFromFile('Foyt1977Splash.bmp');
imgsplash.Canvas.Draw(0,0,mybitmap); // just to see if loaded
mybitmap.SaveToStream(myStream);
showmessage('Size of bmp = ' + inttostr(mystream.Size));
mybitmap.Free;
mystream.Free;
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.