Adding and Saving a Border Around a UIImage with Core Graphics

less than 1 minute read

I recently had to place a border around an image of unknown size and save it back as an image. Here is how:

Start with a UIImage:

Run it through this method:

You will get back a UIImage with a border. Simple.

Obviously, you will need to adjust the border percentage and color for your own application.

Was this page helpful for you? Buy me a slice of ๐Ÿ• to say thanks!