Assume that (x,y) is spatial location of the starting of 8-path. and in image path is represented by 1's and remaining values are 0's.
1. Assign (p,q) is the 8 connected neighborhood of (x,y) which is not processed yet.
2. Check whether the common 4-neighborhood pixel position of (x,y) and (p,q) is part of existing path, if not make any one of the common 4-neighborhood to be 1, else no need to do anything(because it is already 4-connected).
3. assign (x,y)=(p,q)
4. Repeat 1-3 until we process the last element within the path.
You could use the hit-and-miss algorithm to detect pixels directly adjacent to the 8-connected pixels and then change the state of these pixels. If you use Matlab, it could go something like this:
Interval = [0 0 0; 1 -1 0; 0 1 0];
pc = bwhitmiss(pic, Interval);
pic(pc == 1) = 1;
This would change diagonal line segments at 45 degrees with the horizontal line, you would need to adjust the Interval element to cater for the other directions too.
you can search for the diagonal steps in the 8-path and insert an adjacent pixel of the two involved pixels in between. For example, if the step is to the upper right you can insert the right (or the upper) pixel into the path. The horizontal and vertical steps of the 8-path don't need any changes.