> For the complete documentation index, see [llms.txt](https://akila.gitbook.io/fps-framework/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://akila.gitbook.io/fps-framework/tutorials/ui/image-size-fitter.md).

# Image Size Fitter

This component automatically resizes the rect transform to fit the dimensions of the supplied image.

To use it you would simply need a gameobject with an image or image raw component on it, like this:

<div align="left"><figure><img src="/files/xY7TlpVNlSgNMBnHN6d4" alt="" width="374"><figcaption><p>Image's inspector</p></figcaption></figure></div>

The rect transform's size is currently set at (100, 100). The sprite may be stretched if you add it to the source image field in the Image component because of the diffrence between the image's rect transform size and source image's dimensions. In doing so, the Image Size Fitter attempts to match both.

The source image is wide in dimensions, and the image's rect transform is cube shaped. Adding the component, "Image Size Fitter" to the image makes it fit.

<figure><img src="/files/mruxddBstZeOoSlsR1Om" alt=""><figcaption><p>The image after fitting its size with its source image</p></figcaption></figure>

By adjusting any of the x or y values of the delta size of the rect transform, this can update in real time and maintain the original shape of the image.
