Detect and remove excess solid color padding around and NSImage

30 Views Asked by At

I'm trying to build an macos utility to help me center the content of the image and not sure how I would achieve such. For example let say that I have an image as below:

enter image description here

As you can see there's more white space on the right side of the image, what I'm trying to do is to detect that there's more white space there and trim those so that the amount of white space on both sides (left and right) are equal, making the content of the image center.

Obviously it should apply for both vertical and horizontal axis. I'm new to macos programming so any pointers/help would be greatly appreciated.

0

There are 0 best solutions below