Einzelnen Beitrag anzeigen

Benutzerbild von DGL-luke
DGL-luke

Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
 
Delphi 2006 Professional
 

Re: BMP (nicht genügend speicher) JPG 4 MP

  Alt 17. Aug 2006, 13:36
warum eigentlich stretchdraw?

Delphi-Quellcode:
//initialization
uses jpeg;

function JPGToBMP(jpgImg: TJPEGImage): TBitmap; overload;
function JPGToBMP(jpgFile: string): TBitMap; overload;

//implementation

function JPGToBMP(jpgImg: TJPEGImage): TBitmap;
begin
  Result := TBitmap.Create;
  with Result do
    begin
      Width := jpgImg.Width;
      Height := jpgImg.height;

      Canvas.Draw(0,0,jpgImg);
    end;
end;

function JPGToBMP(jpgFile: string): TBitMap;
var jpgImg: TJPEGImage;
begin
  jpgImg := TJPEGImage.Create;
  jpgImg.LoadFromFile(jpgFile);
  Result := JPGToBMP(jpgImg);
  //nur zur sicherheit
  jpgImg.Free;
end;
EDIT: Vervollständigt... wer will, kanns gerne für die codelib vorschlagen
Lukas Erlacher
Suche Grafiktablett. Spenden/Gebrauchtangebote willkommen.
Gotteskrieger gesucht!
For it is the chief characteristic of the religion of science that it works. - Isaac Asimov, Foundation I, Buch 1
  Mit Zitat antworten Zitat