private static int getTrimmedYStart ( BufferedImage img ) { int width = img . getWidth ( ) ; int height = img . getHeight ( ) ; int yStart = height ; for ( int i = 0 ; i < width ; i ++ ) { for ( int j = 0 ; j < height ; j ++ ) { if ( img . getRGB ( i , j ) != Color . WHITE . getRGB ( ) && j < yStart ) { yStart = j ; break ; } } } return yStart ; }
Get the first non - white Y point