In my first attempt, I tried to find X and Y (width and height) by trying looking for X number of fully transparent pixels at Xx1+0+X and then Y number of fully transparent pixels at 1xY+Y+0. If either of these fails, it tries again, but FOUND_Xx1+0+X and 1xFOUND_Y+Y+0. This recalculates with the actual width or height instead of looking with height and width equal.
Now this new case has me stumped. I'm not able to find either width or height with my algorithm.
Here are screenshots of bounding squares for width and height. 1 pixel off from actual content because it is checking for transparent pixels.


How should I proceed?