CodePudding user response:
ImageEN use ah, I used for many years,CodePudding user response:
ImageEN more powerful, scalable, can rotate, if just adaptive scaling, can complete with own image,CodePudding user response:
Use a TBitMap to Draw the ripping it is smaller, BitMap. Canvas. The Draw...CodePudding user response:
Smaller size, better to do, the use of the Image, you can,Reference code:
procedure TSeleteImageFrm. ChangeAnyPixels (Bmp: TBitmap; NewBmp: TBitmap; Width, Height: Integer);code for reference only,
//Bmp source map NewBmp new Width Height high pixel wide
The begin
NewBmp. Width:=Width;
NewBmp. Height:=Height;
NewBmp. Canvas. StretchDraw (NewBmp. Canvas. ClipRect, Bmp);
The end;
Procedure TSeleteImageFrm. Button2Click (Sender: TObject);
Var MyRect NewRect: TRect;
Bmp, NewBmp: TBitmap;
FileName: the string;
The begin
Image1. Picture. LoadFromFile (FileNAME);
Bmp:=TBitmap. Create;
NewBmp:=TBitmap. Create;
MyRect:=the Rect (XX1, YY1 XX2, YY2);
NewRect:=the Rect (0, 0, XX2 - XX1 YY2 - YY1);
Bmp. Canvas. CopyRect (NewRect, Image1. Canvas, MyRect);
Case ComboBox1. Less ItemIndex of//shrinkage
0: ChangeAnyPixels (Bmp, NewBmp, 100133);
1: ChangeAnyPixels (Bmp, NewBmp, 150200);
2: ChangeAnyPixels (Bmp, NewBmp, 200266);
3: ChangeAnyPixels (Bmp, NewBmp, 225300);
4: ChangeAnyPixels (Bmp, NewBmp, 300400);
The end;
Image1. Picture. The Bitmap. The Assign (NewBmp);
Image1. SaveToFile (ImagePath + TempName + '. BMP ');
Bmp. Free;
NewBmp. Free;
The end;
CodePudding user response:
Do not need to write any code, ImageEn have zoom function, I estimate that you want is how to compress the picture,