While creating any new photo gallery in WordPress, you can set all its image links either to attachment page or their media file location but there is no default feature to specify custom links for each image showing up on the gallery which you have created. This tutorial explains how you can easily specify custom links for images in gallery.
For Specifying Custom Links For Gallery Images:
Install and activate WP Gallery Custom Links. Nothing to configure upon activation, there is no options page so simply start by creating a new post or whatever and create a new image gallery using same old WP feature (Posts -> Add New -> Add Media -> Create Gallery). What you will notice is custom link fields for individual images you have added in your gallery.
Using these new meta fields you can very easily link any individual image in your gallery to a post, custom post type, page or to any external webpage. Also you can define the link target which means you can set the link to open in the same window or a new tab. There are more options like filtering links etc, all are listed at the plugin’s download page.