title: Remove blank space in image JAVA
body: <p>I have a question regarding cutting the blank space in image (or just croping it). I want to have a method like this:</p>
  
  <pre><code>public BufferedImage crop(BufferedImage input) {
      return output;
  }
  </code></pre>
  
  <p>And it should do this:</p>
  
  <p><a href="https://i.stack.imgur.com/IGTRS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IGTRS.png" alt="http://i.stack.imgur.com/IGTRS.png"></a></p>
  
  <p>I know that I could go through all the pixels to get new bounds, but for exapmle with image 1024x768 I would have to go through 1024*768 = 786432 (times 2 because I must go through first time to get height bounds and second time to get width bounds) pixels. And this is not a good way. Is there any ideas how to do this quickly? (I don't want to use neihter any additional threads nor any additional frameworks if this is possible)</p>
  
  <p>Thank you!</p>