The code for item sprite generation is not made by one of our contributor as far as I know. You can find it in RuntimePreviewGenerator static class. there's a link toward github not functionning anymore. The code is quite complex and not clearly documented.
The idea is to take an item, set up a camera so that the item is well centered in the camera FOV, make a render using the camera and putting it into a 2D texture. I don't know much more about it sadly.