Obviously you can't retain IDs if for example you have image 123 already in XFMG and also image 123 in Photopost.
Redirection scripts don't always require (and actually shouldn't) require needing to retain IDs.
XF maintains an import log which maps old content ID with new content ID. This log can be used for redirections.
After all, if you retain the content IDs you don't need any scripts for that at all - you can just do basic redirect rules.