first task is getting the file into memory.
there are jpg libraries on most linux systems.
Rescaling the image should have a library but I wouldn't know one except gtk, the foundation of gnome desktops so I do not know how well it would work in your thoughts.
saving the file out is saving it a desired format. Jpg library for jpgs png library for pngs.
All the code is out there to do this pretty handily. Linux may have all the libraries loaded on a development platform for graphics stuff.
This is pretty complex if you don't understand the basics of C/C++. have you searched for someone elses image scaler program out there? Gimp could do it quite easily and its based on the Gtk.