Hey, I'm wondering if it would be relatively not so hard to add some algorithms in my code to shrink the size of images?

So say I told my program to add all of My Pictures to it, can I shrink it somehow?

WinRar does a nice job, how complex is it lol?

What exactly is the process of shrinking the images, I don't quite understand it, (or shrinking anything, music, videos, text)

Kind Regards