Scale and Centre Image

This simple piece of code will attempt to scale and center an image to 'best fit' it into a DIV of your choosing. Note that it attempts to fill the DIV completely, so you may not get the result you want

However it can be extremely useful if you have a lot of images that are of a similar size and orientation. Try some copying and pasting any landscape image URL into the box below, or try a few of these:-

The image as it is

The image scaled and centered to fit a 320 x 225 px DIV