![]() |
Thumbnail eines JPEGs in einem TBitmap speichern...
Hallo,
ich erstelle mit folgender Funktion Thumbnails von Jpegs:
Delphi-Quellcode:
Leider ist diese Funktion unendlich langsam. Weiß jemand wie man das beschleunigen kann? das TBitmap thumb wird schon erstellt übergeben (daher kein create).
procedure createthumb(thumb: TBitmap; datei: string; hoehe, breite: integer);
var tjpg: TJpegImage; tx,ty,tb,th: integer; begin tjpg:=TJpegImage.Create; try tjpg.LoadFromFile(datei); finally tb:=round(tjpg.Width/breite); th:=round(tjpg.Height/hoehe); if tjpg.Width>tjpg.Height then begin tx:=0; ty:=hoehe-(round(breite/th) div 2); end else begin tx:=breite-(round(hoehe/tb) div 2); ty:=0; end; thumb.PixelFormat := pf24Bit; thumb.Width:=breite; thumb.Height:=hoehe; thumb.Canvas.Rectangle(0,0,breite,hoehe); thumb.canvas.StretchDraw(Rect(tx,hoehe-ty,breite-tx,ty),tjpg); end; tjpg.Free; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:09 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz