There is nothing in Google's TOS that says you cannot use images near your ads. Furthermore, it's only been hinted by Google that by putting a 1 pixel border around your images keeps it kosher. Considering that a 1px border is quite small, then it doesn't really matter overall. But as long as it's not listed in their TOS, then it's technically fine.
YPN is a whole 'nother story. They require publishers to seperate the images from the ads. They are becoming more and more strict about it too. So unless you put a very thick/solid border seperating the images from the YPN ads, you may be in violation, and may lose your account for life. It would definitely suck to be banned before they come out of beta, because I heard there are a ton of new enhancements coming our way this Fall.