Personaly I prefer GD2. It atleast twice faster and much easier to work with and its avalable on 90% of the hosts.
But IM supports much more image formats, and u can do almost anything to the images, if I'm not misstaken, u can even create animated .gif images (I might be wrong on that one), well, atleast it can resize the animated .gif images without loosing the animation (lattest GD2 can only "capture" first frame)
The quality - I can not really say which is better, but IM produces images with smaller filesize compare to GD2, when used same quality level.