P
P
para_noir_in_my_box2013-12-03 09:54:32
Graphic arts
para_noir_in_my_box, 2013-12-03 09:54:32

Is there a batch image processing program that can convert a rectangular photo into a square one and center it?

Good afternoon.
There are 2-5 GB of images. The most different.
Required:
1. Reduce to the desired square size.
2. Center.
Images should not become distorted.

Answer the question

In order to leave comments, you need to log in

9 answer(s)
W
Walt Disney, 2013-12-03
@para_noir_in_my_box

I've always done this in Photoshop.
1) Open one picture
2) Click on REC in the action box
3) Resize the open picture and press stop
4) Somewhere in the File menu, find the Batch command, in the window that opens, select the action that you recorded, and the folder where your pictures are located .
The beauty is that when recording an action, you can add any number of actions on images, for example, auto contrast, auto-leveling, adding copyright, frames, filters, etc.
Another option in Photoshop, from some versions, such a thing appeared File> Scripts> Image Processor - it's just a resize of the images folder

E
egor_nullptr, 2013-12-03
@egor_nullptr

bash + imagemagick

D
Denis Ineshin, 2013-12-03
@IonDen

irfanview -> batch resize

D
Dmitry Filatov, 2013-12-03
@i_dozi

Maybe I'm confusing something, but how can you make a square out of a rectangular one without distortion? If only cut. If this is your case, then here is XnView . There is batch processing of files, everything is simple, visual, fast and free.

D
Dmitry Kiroshev, 2013-12-03
@DikSoft

Lazarus ( www.lazarus.freepascal.org/index.php ) in hand, the final picture on the form, take the original one, process it with this procedure. The meaning, I think, is clear. If you need - I can lay out all the sources.

Procedure TForm1.StretchFine(inPicture: TPicture; OutImage: TImage);
Var A, B, X, Y, X1, Y1, DX, DY: integer;
  r1, r2            : real;
  StretchFineImage  : TImage;
Begin
  A := OutImage.width;
  B := OutImage.height;
  StretchFineImage := TImage.Create(Nil);
  StretchFineImage.width := a;
  StretchFineImage.height := b;
  StretchFineImage.left := 0;
  StretchFineImage.Top := 0;
  X := InPicture.width;
  Y := InPicture.height;

  R1 := X / Y;                          //соотношение в исходной картинке
  R2 := A / B;                          //   --       в итоговой картинке

  If r1 > r2 Then Begin
    x1 := A;
    y1 := trunc(A / X * Y);
  End Else Begin
    x1 := trunc(B / Y * X);
    y1 := b;
  End;
  Dx := trunc((a - x1) / 2);
  Dy := trunc((b - y1) / 2);
  StretchFineImage.Canvas.Brush.Color := clWhite;
  StretchFineImage.Canvas.FillRect(rect(0, 0, a, b));
  StretchFineImage.Canvas.StretchDraw(rect(Dx, Dy, a - Dx, b - Dy), InPicture.Graphic);

  OutImage.Picture := StretchFineImage.Picture;
  StretchFineImage.Free;
  StretchFineImage := Nil;
End;

D
Daniel, 2013-12-03
@r1d2

If you have Photoshop, then you can create a droplet for this task.

A
Alexey Boldyrev, 2013-12-03
@allexb

Create an action in Photoshop.

T
Timur Tuz, 2013-12-03
@TTA

FSResizer. Very simple and knows how to dofiga.

E
eps, 2014-01-20
@eps

There are several ways to turn a rectangular image into a square one:
- Crop the edges of the image to a square
- Add black / white margins to a square
- Stretch disproportionately
- Using the liquid rescale / seam carving algorithm
In any case (except for the second one), the image will be distorted. See www.imagemagick.org/Usage/resize
for more details on how to resize . And of course ImageMagick will help you with any scenario.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question