Fixes #1600 - Invalid path returned by sprite_file

When specifiying a generic_images_dir sprite_file would return the wrong
path to the original image because this was relative to the generic_
images_path instead of the images_path.

This should fix all problems related also to: #1617 and #1665