Create clipmaps

Pls. can you help me with this:
I’m working on a terrain rendering. I have downloaded an elevation map 21600x10800. Now I need to divide them and make clipmaps. The question is how to do that. I mean manually (gimp/photoshop) is no problem but I guess that that is not the way.
So the question is - how should I make the clipping?