How to resize an image.

This code can be used to resize an image
to a new max height or width.
To fit in a desired space.

Example below