I did this a few times with DD1, but due to her throwing them all around the room and at doors and walls when having her raging tantrums. All the books she throws get taken and put away, and she doesn't get them back until I am satisfied she will look after them. I have a nice pile of them in my room at the moment. I haven't had to take them all for a while now though, but we did have the first incident in ages last week (hence the pile in my room )

I don't think it is mean. It is pretty much a standard in our house, if you can't look after something, it will be taken away until you can. If it persists, then it will be given away to another little girl who can't have one of her own but would look after it.
I think if you sit her down and explain why you are taking them and exactly what you expect from her, and give her the opportunity show you she can behave with them properly, it is a good lesson to learn. Books are very precious things and we work hard to provide her with all her toys, books and things, and it is ok (and crucial I think) to expect they treat them with respect (as per their age).