set image extension if it is not set