title: Detecting a rectangle of certain color in an image
body: <p>I have a lot of images like the ones in this gif:
  <a href="https://i.stack.imgur.com/3B3PR.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3B3PR.gif" alt="enter image description here"></a></p>
  
  <p>I want to crop them to remove the uneven border and leave only the writings inside of the border, for example:
  <a href="https://i.stack.imgur.com/Q78tf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q78tf.jpg" alt="enter image description here"></a></p>
  
  <p>Some of the source images are a bit rotated and there is a slight difference in the border location so I need something to dynamically find the rectangle surrounding the writings.</p>
  
  <p>What is the best way of doing that?</p>