Added addToFileIdPinList method to loadImage

It was previously in writeImage erroneously.