You just shift the range to <-1.0,+1.0> so
if you got color channels in range <0.0,1.0>
// a)
nx=(2.0*r)-1.0
ny=(2.0*g)-1.0
nz=(2.0*b)-1.0
or:
// b)
nx=2.0*(r-0.5)
ny=2.0*(g-0.5)
nz=2.0*(b-0.5)
 
if you got 8bit per channel then the range is <0,255>
nx=(float(r)/127.5)-1.0
ny=(float(g)/127.5)-1.0
nz=(float(b)/127.5)-1.0
 
If you look at the normal map image you should see the bluish colors because neutral normal=(0,0,1) pointing up from a flat face is encoded as color=(r=0.5,g=0.5,b=1.0) like here:

also have a look here: Normal mapping gone horribly wrong where the normal is computed from such texture in GLSL by #1b method:
const vec4 v05=vec4(0.5,0.5,0.5,0.5);
texture2D(txr_normal,pixel_txr.st)-v05)*2.0;
Also the (r,g,b) can be mapped to (nz,ny,nx) instead of (nx,ny,nz) in that case just swap r,b (the normal map is then red-ish instead)