code: private static int getTrimmedXStart(BufferedImage img) {
      int height = img.getHeight();
      int width = img.getWidth();
      int xStart = width;
  
      for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
          if (img.getRGB(j, i) != Color.WHITE.getRGB() && j < xStart) {
            xStart = j;
            break;
          }
        }
      }
  
      return xStart;
    }
docs: Get the first non-white X point
  @param img Image n memory
  @return the x start