It's a bug, most commonly happens if you delete images by deleting a tab that contains the images. (There's other ways to cause it too, though I can't remember them off the top of my head.
I tested this out with one of my characters who had a messed up count so a quick fix would be to make a temporary tab and move all the images into that tab (using Manage Images) and then moving them back. That might fix your count for you!