How to set default program to open specific file type

For some of the system default apps you can go to System Settings/Details e.g.:

Or for more advanced you can open Ubuntu-Tweak and go to Admins section and click on File Type Manager:

To install Ubuntu-Tweak:

sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak

P.S.

I see you edited a bit your question you want Gimp to open all your photos or pics right? Using my workaround please do mention also that if you change from Image Viewer to Gimp it doesn't mean that you will open all photos with Gimp because this setting serves for .jpg/.jpeg and Gimp for example saves its work in .png portable network graphics by default and the default for .png will be Image Viewer anyways :) so to change that you need to configure all photos formats using Ubuntu-Tweak so they open with Gimp when you double click on them.