People are made to believe that the number of megapixels determine the quality of the pictures: it does not. it's just that the number of pixels on a photo is the easiest thing to sell because you immediately see its outcome - believe me, if you shoot a lot of these huge megapixel photos then you will soon find yourself wondering where all your harddisk space went.
So, do you really need all those megapixels?
Well, in this facebook/twitter dominated world, where people don't actually print pictures anymore and just view stuff on their portable devices, you only just need about 2-3 megapixels. Why? Because there is no screen in the world that can show your 40 megapixel photo in its actual size. [For comparison IMAX is only 27 megapixels and your HDTV only has 2.1 megapixels.]
So what should you consider when you're out to buy your next camera?
It should be this: the camera's sensor size.
This is the thing that determines the quality of the pictures. The bigger the sensor size is, the better your pictures will be. But of course, you should also consider the size of the picture for a given sensor size: the camera with the smaller megapixel count will produce much better photos for the same sensor size.
Oh, and yes, even if you have the biggest sensor size in your camera, you still need to learn about composition, rule-of-thirds...
Things that make a compelling picture...
Below are the Canon cameras with bigger sensor sizes. If you want to produce good quality photos, don't give in to camera makers, or sellers, that tell you that bigger megapixel counts are better. Ask rather what the sensor size is.
[NB: I am not saying that Canon cameras produce much better pictures, nor do I say that Canon is the only camera maker that produces cameras with bigger sensors. It's just that I am more familiar with Canon since I shoot with this brand. I am not one to go into, nor start, a brand war.]