JPEG Kompression

// die Header-Datei jpeg.hpp muss eingebunden sein
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    TJPEGImage *jpg = new TJPEGImage();

    try
    {
        jpg->LoadFromFile("c:Tempsq15.jpg");
        jpg->CompressionQuality = 1; // 1..100
        jpg->DIBNeeded();
        jpg->Compress();
        jpg->SaveToFile("c:Tempcompressed.jpg");
    }
    catch ( ... )
    {
        ShowMessage("Compression error.");
    }

    delete jpg;
}