Arsip: croping image dari gambar JPG

 
user image
more 14 years ago

46uh

Allo smoa.. butuh cepet jawban nich.. pleaze!! gimana cara croping image dari gambar JPG
user image
more 14 years ago

46uh

maksudnya script delphi nya bukan pake mspaint 8)
user image
more 14 years ago

DelphiExpert

Langkah2nya: 1. Buka file menggunakan TPicture (TImage misal) 2. Bytes bitmap dapat diakses melalui property Picture.Bitmap 3. Buat TBitmap baru 4. Copykan Picture.Bitmap.Canvas ke Bitmap.Canvas (baru) dengan crop-region sebagai parameternya 5. Buat TJPEGImage baru, assign-kan bitmap baru tsb ke TJPEGImage 6. TJPEGImage.SaveToFile(...);
user image
more 14 years ago

46uh

4. Copykan Picture.Bitmap.Canvas ke Bitmap.Canvas (baru) dengan crop-region sebagai parameternya
bisa tau script nya ...??? :)
user image
more 14 years ago

DelphiExpert

asumsi: - gambar asli berukuran 800 x 600 - crop ke 400 x 400, start point 0, 0

var CropBmp: TBitmap;
  Dest, Source: TRect;
begin
  // do initial tasks here
  CropBmp:= TBitmap.Create;
  try
    Dest:= Rect(0, 0, 400, 400);
    Source: Rect(0, 0, 400, 400);
    CropBmp.Width:= Dest.Right - Dest.Left;
    CropBmp.Height:= Dest.Bottom - Dest.Top;
    CropBmp.Canvas.CopyRect(Dest, Picture.Bitmap.Canvas, Source);
    // do another tasks here
  finally
    CropBmp.Free;
  end;
end;
user image
more 14 years ago

46uh

@DE makasih banget... :D
user image
more 14 years ago

DelphiExpert

@46uh same-same xixix :mrgreen:
more ...
  • Pages:
  • 1
Share to
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com