I have a collection of photos taken from my digital camera. All of them were taken with the same settings (same resolution etc...). However all these pictures have different file sizes. Why is this? Could it be because of the colors or something?
JPEG and many others formats use compression algorithms to optimize the file size, which will cause it to depend on the content.
A picture with more gradients, colors and details should generate a bigger file in size than one containing simpler forms, even if both use the same resolution and compression level.
Unlike JPEG, file formats like BMP and TGA do not use compression and their size will depend only on the resolution and color depth of the pixels.