procedure ScaleToFitCentered(width, height: integer);

Scales the image so that it fits inside the specified dimensions, centering the new image to preserve image geometry. Unless the supplied width and height exactly match the image's geometry, the new image will also have some transparency adjacent to either its vertical or horizontal edges.