For to manipulate the image, alls informations you need are already used at the line that load the texture from the RAM to OpenGL ...
Code :glTexImage2D(GL_TEXTURE_2D, 0, ilGetInteger(IL_IMAGE_BPP), ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData()); /* Texture specification */
For to write it, use this DevIL functions :
(you can found a .pdf file that explain how to use DevIL at http://openil.sourceforge.net/docs/DevIL%20Manual.pdf)Code :ILboolean ilSaveImage(const char *FileName);