public Point findSubImage( Image img ) {
        int widthDiference = buffer.getWidth() - img.getWidth();
        int heigthDiference = buffer.getHeight() - img.getHeight();
        if( widthDiference<0 || heigthDiference<0 )
            return null;
        
        int validatedPixels = 0;
        int imgSize = img.getWidth()*img.getHeight();
        for (int i = 0; i < widthDiference * heigthDiference; i++) {
            int X = i % widthDiference;
            int Y = i / widthDiference;
            for (int j = 0; j <imgSize; j++) {
                int x = j % img.getWidth();
                int y = j / img.getWidth();
                
                if (buffer.getRGB(X+x, Y+y) == img.getRGB(x,y) 
                        || img.getRGB(x,y) == Color.BLACK.getRGB()) {
                    validatedPixels++;
                    if (validatedPixels == imgSize)
                        return new Point(X,Y);
                }
                else if( img.getRGB(x,y) != Color.BLACK.getRGB() ){
                    validatedPixels = 0;
                    break;
                }
            }
        }
        return null;
    }