Home > Back-end >  Methods consult use ImageEN resized images
Methods consult use ImageEN resized images

Time:09-15

Some photos, want to use ImageEN to batch processing, to reduce the size, I don't know which control method with?

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); 
//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;
code for reference only,

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,
  • Related