Transformation optics provides a powerful tool for controlling electromagnetic fields and designing novel optical devices. In practice, devices designed by this method often require material optical properties that cannot be achieved at visible or near IR light wavelengths. The conformal transformation technique can relax this requirement to isotropic dielectrics with gradient refractive indices. However, there are few effective methods for achieving large arbitrary refractive index gradients at large scales, so the limitation for building transformation optical devices is still in fabrication. Here we present a photoelectrochemical (PEC) silicon etching technique that provides a simple and effective way to fully control the macro scale profiles of refractive indices by structuring porous silicon on the nanoscale. This work is, to our knowledge, the first demonstration of using light to control porosity in p-type silicon. We demonstrate continuous index variation from n = 1.1 to 2, a range sufficient for many transformation optical devices. These patterned porous layers can then be lifted off of the bulk silicon substrate and transferred to other substrates, including patterned or curved substrates, which allows for the fabrication of three dimensional or other more complicated device designs. We use this technique to demonstrate a gradient index parabolic lens with dimensions on the order of millimeters, which derives its properties from the distribution of nanoscale pores in silicon.