Autor Beitrag
dirkil2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: Do 30.09.04 10:12 
Ich möchte ein JPEG aus einem File einlesen, es verkleinern und dann das verkleinerte Bild wieder als .JPG File abspeichern, das dann natürlich kleiner sein sollte. Weiß jemand, wie das geht?
dirkil2 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: Do 30.09.04 10:36 
Ich bin schon ein Schritt weiter gekommen. Ich kann jetzt ein JPEG verkleinern, aber die Farben stimmen in dem verkleinerten JPEG File nicht. D.h. die meisten sind schon in Ordnung ein paar sind völlig falsch.
Hat das was mit den Paletten zu tun? Wer weiß mehr?

Hier ist mein Code:

ausblenden volle Höhe 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:
31:
32:
33:
34:
35:
procedure TForm1.Button1Click(Sender: TObject);
bmp1, bmp2: TBitmap;
j, j2:TJPEGImage;
begin
  j:= TJPEGImage.Create;
  j2:= TJPEGImage.Create;
  bmp1:= TBitmap.Create;
  bmp2:= TBitmap.Create;
try

  j.PixelFormat := jf24Bit;
  j.loadfromfile('I:\tmp\DSC04389.jpg');
  bmp1.assign(j);

  with bmp2 do
  begin
    width:= 200;
    height:= 200;
    Canvas.Copyrect(rect(0,0,200,200),
                    bmp1.Canvas,
                    rect(0,0,j.Width,j.Height));
  end;
  j2.CompressionQuality := 100;
  j2.PixelFormat := jf24Bit;
  j2.Assign(bmp2);
  j2.SaveToFile('I:\tmp\xxx.jpg');

finally
  j.Free;
  j2.Free;
  bmp1.Free;
  bmp2.Free;
end;

end;


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt
dirkil2 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: Do 30.09.04 11:17 
habe die Lösung gefunden und zwar hier: www.lmc-mediaagentur.../dpool/tips/0353.htm
Bennle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 101

WinXP
Delphi 2007 Pro, C# (VS 2005)
BeitragVerfasst: Do 12.01.06 08:44 
user profile icondirkil2 hat folgendes geschrieben:
habe die Lösung gefunden und zwar hier: www.lmc-mediaagentur.../dpool/tips/0353.htm


Hallo,
mich würde die Lösung dazu interessieren. Kannst du Sie evtl Posten, denn der Link funktioniert nicht mehr.

MfG
Bennle