Converting JPGs to BMPs
From: Christakis John (dontemail_at_me.please.ok)
Date: 11/10/04
- Previous message: Nicholas Ring: "Re: FindFirst Question"
- Next in thread: Christakis John: "Re: Converting JPGs to BMPs"
- Reply: Christakis John: "Re: Converting JPGs to BMPs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 10 Nov 2004 06:52:52 GMT
Hiya,
I am trying to do this using streams instead of files. I started with this
code:
procedure Jpeg2Bmp(const BmpFileName, JpgFileName: string);
var
Bmp: TBitmap;
Jpg: TJPEGImage;
begin
Bmp := TBitmap.Create;
Jpg := TJPEGImage.Create;
try
Jpg.LoadFromFile(JpgFileName);
Bmp.Assign(Jpg);
Bmp.SaveToFile(BmpFileName);
finally
Jpg.Free;
Bmp.Free;
end;
end;
and changed it like this:
try
jpg.LoadFromStream(stmPhoto);
Bmp.Assign(Jpg);
Bmp.SaveToStream(stmBitmap);
finally
Jpg.Free;
Bmp.Free;
end;
where stmPhoto is a TStream of a jpeg read from a database blob field and
stmBitmap is a clean TStream object. I get 'Abstract errors'? Is there an
easy way to do this? It feels like I am close, but I just can't get it
working. I have looked at stmBitmap and it appears to contain the Jpeg
info - there is a 'JFIF' eg.
tia,
cj
- Previous message: Nicholas Ring: "Re: FindFirst Question"
- Next in thread: Christakis John: "Re: Converting JPGs to BMPs"
- Reply: Christakis John: "Re: Converting JPGs to BMPs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|