The following will show you how to bake an object’s image texture, materials and lighting into a single image file. Update: the following article uses Blender 2.79b with Cycles Engine.
1) Create a new texture ‘bake-me’ from the UV image editor
2) Select the object you want baked and open the node editor. Add that new texture ‘bake-me’ to the material nodes, make sure it is highlighted (it does not need to be attached to anything).
3) Create a new UVmap group.
4) Enter edit mode to check your object’s UV mapping. As you can see, the UVs must be scaled to fit inside our ‘bake-me’ image.
5) In the UV Image editor with ‘bake-me’ selected, scale the UVs to fit inside the new image.
6) In the render panel, find the ‘Bake’ menu and choose ‘diffuse’ and select ‘color’. (these options will only select the texture data, no lighting. This is useful for characters in game engines. Choose ‘combined’ to bake all lighting and shading data into the image (make sure all necessary lights are turned on). This is useful for online galleries such as SketchFab and other scenarios in which the objects will be viewed without external light sources affecting them.)
7) After baking, you will now see that the texture is baked and fits inside the image ‘bake-me’. Select ‘image’ and choose ‘save-as’ to save the texture to your hard drive.
NOTE: When you are ready to export your object (FBX, OBJ, etc) make sure to select the newly created UVmap group. This tells the object to use this mapping for the texture.