Help:Creating Square Images

Jump to: navigation, search

So you have a rectangular image and you need it to be square, whilst preserving the aspect ratio?

Here's how to do it.

Method

The trick is to create a new blank square image, the same size as the largest dimension of your existing image, and place your old image centered within it.

These are the steps.

1. Find out the dimensions of your image.
2. Create a blank image, which should be a square, with each side the same length as the longest dimension of your image.
3. Select the whole of your image and select copy.
4. Paste your image into the blank image.
5. Center it within the image.

The last two steps are the tricky bit, you can do it by eye with some software - but it's hard to get right. The best policy is to create a selection box on the blank image exactly where you want the image to go, and then "paste into" this selection box.

Alternatively, you can use our online utility, SquareIt.

Example

As an example, we will use the site logo, a rectangular image, together with the IrfanView image software. IrfanView is freeware, very fast, reliable and good for processing and displaying images of all types.

 Site Logo (300x52)
1. Find out the dimensions of your image.

Once an image is loaded in IrfanView, the dimensions should be displayed in the status bar on the bottom left-hand corner - if you can't see them, select Image→Information from the menus (you can press I as a shortcut).

In this case, the image is 300x52 pixels, that is 300 pixels wide and 52 pixels high.

1. Create a blank image, which should be a square, with each side the same length as the longest dimension of your image.

The longest dimension is the width, which is 300 pixels. So we need to create a blank image 300x300 pixels in size. Blank means the colour of the background, which in this case is white.

In IrfanView, only one image is displayed at a time. So before we create the new image, it would be a good idea to copy the original image so we have it available when we need it.

1. Select the whole of your image and select copy.

No selection is necessary in IrfanView, the Copy command will default to the whole image. Select Edit→Copy from the menus.

To create the blank image, select Image→Create New (empty) image from the menus, this will present the following box:

Fill in the image width and height boxes and set the background colour. In this case, that's 300x300 pixels, with a white background.

You will now have a blank white image, 300x300 pixels.

1. Paste your image into the blank image.
2. Center it within the image.

In IrfanView the best way to do this is as mentioned above, creating a selection box in exactly the right place and then pasting into it. We do this by using the Custom Crop feature. To access this select Edit→Create custom crop selection from the menus, this will present the following box:

Switch the aspect ratio to "None" and then fill in the values for the 'x' and 'y' coordinates, as well as the width and height.

• 'x' represents the position along the width, if the width is the largest dimension set this to 0 (zero), otherwise set it to the special calculated value (see below).
• 'y' represents the position along the height, if the height is the largest dimension, set this to 0 (zero), otherwise set it to the special calculated value (see below).
• width - should be set to the width of the original image.
• height - should be set to the height of the orignal image.

The "special calculated value" is the position where the old image must be placed within the new square image. This value is the middle of the image, less half the length of the shortest side - this will place the middle of the original image on the middle of the square. The following equation will help you work it out:

$\mbox{special value} = \frac{\mbox{square dimension}}{2} - \frac{\mbox{shortest dimension}}{2}$

For our example, this value would be as follows:

$\mbox{special value} = \frac{300 \mbox{px}}{2} - \frac{52 \mbox{px}}{2} = 150 - 26 = 124$

Once you've filled in the values, click "Apply to image".

The final step is to paste the original image in, we do this by selecting Edit→Paste from the menus.

The resulting image can then be saved.

 Square Site Logo (300x300)

Utility

There is an alternative however, we have developed a utility to do the whole process for you online. Simply follow the link below: