I don’t know how good they are, but people have trained models on that problem. Googling “autocrop tool” gives me multiple options.