As long as you ignore the extra bandwidth from downloading both the non-retina and retina versions with this script, yes, it's pretty easy. Actually serving retina images only for devices that need them, in an efficient and backwards-compatible way is a much harder problem.