Separating image and text regions from an image is a very old problem and many papers have been written about it. One of the recent ones can be found here.
But I didn't find any existing code for this. Before implementing one, I thought it might be a good idea to ask SO community if anyone knows of an existing one.
Please point me to an existing code (preferably Java) if you know.