If you have an external hard drive (an iPod for instance), or something which can store that information, it's dead easy. I had to do this when reinstalling OS X recently. I just backed up the files onto the external drive, and after reinstalling, made sure I copied the folders back into their original places. I'm not sure if iTunes would work OK, as there were songs I didn't want to keep, so I manually added them again, but iPhoto worked flawlessly. I just copied the library folder to where it's supposed to be, opened iPhoto, and the library appeared just fine. So, if you have a means of copying these libraries, back them up, and all you should need to do, is copy them to the same location. Just take note of where they should be on your MBP. I think you're able to designate a new target location for an iTunes library though, but probably better to have it stored in the default location.
Hope all goes well!