بسم الله الرحمن الرحيم
الصلاة السلام على رســــول الله
تحويــــل من الصور bmp الى الصور jpg والعـكـــس .
Convert images to bmp jpg images and vice versa.
Code:
uses jpeg; procedure TForm1.Button1Click(Sender: TObject); var ImageJPEG : TJPEGImage; ImageBMP : TBitmap; begin if OpenPictureDialog1.Execute then begin ImageBMP := TBitmap.Create; try ImageBMP.LoadFromFile(OpenPictureDialog1.FileName); ImageJPEG := TJPEGImage.Create; try ImageJPEG.CompressionQuality:=50; ImageJPEG.Assign(ImageBMP); if SavePictureDialog1.Execute then ImageJPEG.SaveToFile(SavePictureDialog1.FileName); finally ImageJPEG.Free; end; finally ImageBMP.Free; end; end; end; procedure TForm1.Button2Click(Sender: TObject); var ImageJPEG : TJPEGImage; ImageBMP : TBitmap; begin if OpenPictureDialog1.Execute then begin ImageJPEG := TJPEGImage.Create; try ImageJPEG.LoadFromFile(OpenPictureDialog1.FileName); ImageBMP := TBitmap.Create; try ImageBMP.Width := ImageJPEG.Width; ImageBMP.Height := ImageJPEG.Height; ImageBMP.Canvas.Draw(0,0,ImageJPEG); if SavePictureDialog1.Execute then ImageBMP.SaveToFile(SavePictureDialog1.FileName); finally ImageBMP.Free; end; finally ImageJPEG.Free; end; end; end.