Autor Beitrag
Bronstein
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 578
Erhaltene Danke: 1

WIN XP
Delphi 6 / Delphi 2006 / Delphi XE
BeitragVerfasst: Sa 21.10.06 18:11 
Gibt es eine Funktion, die es mir erlaubt ein Bild zuverkleinern. So dass ich z.B. angeben kann das das Bild 500x335 Pixel groß ist.

_________________
Es gibt keine dummen Fragen nur dumme Antworten!!!
Hack Gott
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Sa 21.10.06 18:14 
willst du jetzt nur die Anzeige der Größe in dem Programm oder generell des Bildes verändern.

Im Programm weiß ich wies geht:

Stretch auf True und du kannst es ziehen wie du willst, dann kannst du ev. auch noch Proportional und Center verwenden.

//EDIT: Natürlich muss das Bild in nem TImage sein, die eigenschaften sind ja auch von einem.

_________________
"Je mehr Käse, desto mehr Löcher; Je mehr Löcher, desto weniger Käse. Daraus folgt: Je mehr Käse desto weniger Käse!"
hui1991
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Sa 21.10.06 18:26 
Also das erste in der Google suche "Delphi JPG verkleinern"
War das hier:
[url=www.delphipraxis.net/post20924.html]user defined image JPeg verkleinern [/url]

Hier sicherheitshalber den code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
procedure Resizepicture(filename: string; width, height: integer);
var
  bmp:TBitmap;
  jpeg:TJpegImage;
begin
  Jpeg:=TJpegImage.Create;
  try
    jpeg.LoadFromFile(filename);
    bmp:=TBitmap.Create;
      try
        if jpeg.width>jpeg.Height then
         begin
           bmp.width:=width;
           bmp.height:=height;
         end
        else
         begin
           bmp.width:=height;
           bmp.Height:=width;
         end;
        bmp.canvas.StretchDraw(Rect(0,0,bmp.width,bmp.height),jpeg);
        jpeg.assign(bmp);
      finally
        bmp.free;
      end;
      jpeg.SavetoFile(filename);
  finally
    jpeg.free;
  end;
end;