I am using the clearbit api to get and display company logos in my app. This works great except that all of the logos are different size, and I want them all to be displayed as a square.
Does anybody know how to take a rectangular image and add extra pixels to it of a given color until it becomes square with the logo at the center?
This question seemed to answer it, but it is outdated. I also thought that the top answer on this question would work, but the code didn’t work. Any help would be very much appreciated, thank you!
2
Answers
` func drawImageOnCanvas(_ useImage: UIImage, canvasColor: UIColor ) -> UIImage {
}`
` func imageWithColor(color : UIColor,oriImage:UIImage) -> UIImage{
}`