Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Thumbnail eines JPEGs in einem TBitmap speichern... (https://www.delphipraxis.net/28643-thumbnail-eines-jpegs-einem-tbitmap-speichern.html)

Markus 27. Aug 2004 12:35


Thumbnail eines JPEGs in einem TBitmap speichern...
 
Hallo,

ich erstelle mit folgender Funktion Thumbnails von Jpegs:

Delphi-Quellcode:
    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;
Leider ist diese Funktion unendlich langsam. Weiß jemand wie man das beschleunigen kann? das TBitmap thumb wird schon erstellt übergeben (daher kein create).


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:19 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz