You cannot change the source of an image in CSS. SRC is an html attribute that cannot be overriden. What you can do in CSS is change a background image, but not the primary image. While they render approximately the same, there are a few differences that make background images unsuitable for some purposes, SEO being one of them.
As for serving different content for different user agents, good luck maintaining your database of screen size and densities per UA string, not mentionning that Apple does server the same UA whatever the model of iPhone you have (which can include different sizes and densities).