This image having resolution: 3200x2192 pixels has file size: 5.86 MB while this one has resolution of 6000x4000 pixels but file is of 4.55 MB. What is happening in both cases?
Any help to clear up this is appreciated.
Edit: Consolidating all answers and comments, pixel size is but only one factor of image file size. Others being, amount of details, compression, image noise etc. (future readers, read the answers and comments well to get a perspective). Below is an example of two images of same sunflower, shot under same lighting conditions and having same pixel size too (2592 x 3888), but varying ISO setting and shutter speed:
Image 1 - ISO 100, f/5.6, 1/350 s. Size- 2.17 MB
Image 2 - ISO 1600, f/5.6, 1/4000 s. Size- 4.15 MB
Source: https://en.wikipedia.org/wiki/Image_noise
Thank you, everyone, for providing great answers and comments.