Lets talk about the easy part first! There are numerous places that will accept an "photo" upload over the web (obviously it doesn't have to be a photo - any image will work!), print it on photo paper, and then either mail it to you or have it ready for you to pick-up in store. Google will help you find countless numbers of these, but a few examples include SnapFish and Shutterfly (both give 50 free prints with a new account), as well as familiar names like Walgreens and Target. Some of these sites will also let you do basic image manipulation, such as printing the same photo multiple times on the one photo.
The (slightly) harder part is getting the image you want to print to match the official US passport photo requirements. If you're comfortable with any image manipulation programs (even something as simple as "Paint" under Windows, right up to Photoshop or anything in between) then you can easily create the image yourself to be the right size, and even put multiple of them on a standard 6"x4" photo so that you've got spares for next time.
If you're not comfortable doing it yourself, there are a number of websites that will look after it for you. Again Google can help you out here, but be aware that not all of these websites are free to use. One good example that is free is ID Photo 4 You. This site will allow you to upload a photo and crop it based on the passport photo rules, at which point it will resize the photo and then allow you to download an image with multiple of the photos on a single 6"x4" (or other size) image - ready to be printed!
The Department of State also has their own website that will handle cropping/resizing the image, but will leave it as a single image 600x600 pixels which you'll the need to modify further to get it to be the correct 2" x 2x" size - either in something like Paint, or on the website of the place where you are printing the photo.
I've been doing printing my own passport/visa/etc photos for over 10 years, and I've never had a problem. I do the image manipulation myself, and then get them printed using one of the mechanisms above. Takes the cost from ~$10, to ~10 cents! For Visa applications the US government has even accepted digital photos for years now, however it looks like they still don't for Passport applications.