Einzelnen Beitrag anzeigen

Benutzerbild von Chris WF
Chris WF

Registriert seit: 15. Nov 2004
27 Beiträge
 
Delphi 5 Standard
 
#1

Problem mit Stretchdraw/SaveToFile (Erstellt 0 KB Dateien)

  Alt 29. Mai 2006, 15:33
Hi,

ich schreibe ein Programm, das Thumbnails erstellt, dazu benutze ich 2 Arrays of TPicture. Ich lade die Bilder mit LoadFromFile, ändere die Größe mit Stretchdraw und will dann wieder mit SaveToFile speichern. Aber irgendwie klappts nich so ganz. Es kommt zwar kein Fehler, aber ich hab nachher nur 0 KB Dateien im Zielordner...

Hier mal der Code:
Delphi-Quellcode:
     for i := 0 to count-1 do
     begin
          srcpics[i].SaveToFile(dest + '\img' + inttostr(i) + '.jpg');
          h := srcpics[i].Height;
          w := srcpics[i].Width;
          if h < w then
          begin
               p := h / w;
               r.Left := 1;
               r.Top := 1;
               r.Right := twidth;
               r.Bottom := round(p * twidth);
               tpics[i].Bitmap.Canvas.StretchDraw(r,srcpics[i].Graphic);
               tpics[i].SaveToFile(dest + '\t_img' + inttostr(i) + '.jpg');
          end;
          if h >= w then
          begin
               p := w / h;
               r.Left := 1;
               r.Top := 1;
               r.Right := theight;
               r.Bottom := round(p * theight);
               tpics[i].Bitmap.Canvas.StretchDraw(r,srcpics[i].Graphic);
               tpics[i].SaveToFile(dest + '\t_img' + inttostr(i) + '.jpg');
          end;

     end;
(Die Variablen
Delphi-Quellcode:
Global:
var
  Form1: TForm1;
  src, dest: string;
  twidth, theight, rows, cols, count: integer;
  comment: boolean;
  srcpics, tpics: array of TPicture;
Lokal:
var i, h, w: integer;
var p, q: real;
var r: TRect;
  Mit Zitat antworten Zitat