Autor Beitrag
SHIFTER
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 65

Win 2k SRV, Win XP, Vista, SuSe Linux SRV
Delphi 11
BeitragVerfasst: Mo 17.03.03 00:10 
Hallo,

ich versuche ganze zeit eine grosse JPG datei in ein Mini Bild umzuwandeln.

Z.B. aus 2500x1500 pix in 100x100 pix, (natürlich soll auch die Datei selber in sich verkleinert sein.)

Für eure hilfe bedanke ich mich in vorraus.

mfg
seba
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Mo 17.03.03 00:45 
Leider kenn ich deinen Kenntnis, deshalb vorerst die Kurzversion:

Jpeg in Bmp umwandeln

Dann mit Canvas.CopyRect in eine neue Bitmap kopieren, wobei eine Verkleinerung des ersten Rect-Wertes auch das Bild verkleinert

Dann Bitmap wieder in Jpeg umwandeln

Das wars. Wenn du Hilfe bei der Umsetzung brauchst, dann melde dich nocht mal.

_________________
Popov
FriFra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Mo 17.03.03 09:43 
Mit CopyRect bekommst Du es nicht kleiner... nur einen Ausschnitt. Du musst StretchDraw verwenden.


Zuletzt bearbeitet von FriFra am Fr 25.04.03 21:58, insgesamt 1-mal bearbeitet
anselm
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Fr 25.04.03 15:12 
ok ich will das gleiche machen also eine jpeg datei laden in ein image ist kein problem soweit bin ich schon sinn soll es sein ein bild per openpicturedialog zu wählen dann eine verkleinerung und neu erstellung eines bildes auf der festplatte um es später weiter zu verarbeiten dabei ist es wichtig das das bild die x,y verhältnisse behält was ich schon rechnerisch gelöst habe. nur wie wende ich dieses musst StretchCopy an?
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
image1.Visible := false;
  image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
  image1.Picture.Bitmap.Assign(image1.Picture);
  o_y := image1.Picture.Height;
  o_x := image1.Picture.Width;
  n_x := 150;
  n_y := round(o_y * (n_x / o_x));
  arect.Left := 0;
  arect.top := 0;
  arect.Right := n_x;
  arect.Bottom := n_y;
  edit3.Text := inttostr(n_x);
  edit4.Text := inttostr(n_y);
  image1.Canvas.StretchDraw(arect,image1.Picture.Bitmap);
  image1.Visible := true;
das ist mein versuch bis jetzt
anselm
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Fr 25.04.03 15:34 
danke hat sich erledigt habe es jetzt so gemacht!
ausblenden volle Höhe 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:
31:
32:
33:
34:
35:
36:
37:
38:
procedure Tdaten.Button3Click(Sender: TObject);
var bmp:TBitmap;
    jpeg:TJpegImage;
    o_x, o_y, n_x, n_y : integer;
begin
 OpenPictureDialog1.Execute;
 if OpenPictureDialog1.FileName <> '' then
 begin
   Jpeg:=TJpegImage.Create;
   try
   jpeg.LoadFromFile(OpenPictureDialog1.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;
        n_x := 150;
        n_y := round(bmp.height * (n_x / bmp.width));
        bmp.Width := n_x;
        bmp.Height := n_y;
        bmp.canvas.StretchDraw(Rect(0,0,n_x,n_y),jpeg);
        jpeg.assign(bmp);
      finally
       bmp.free;
      end;
   finally
  image1.Picture.Bitmap := bmp;

  image1.Visible := true;
 end;
 end;
end;
anselm
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Do 08.05.03 13:42 
komisch also manchnaml klappt es manchmal nicht kann mir jemand helfen?