You can dynamically allocate memory using sys_malloc. But as you most probably want a texture as result, I would just manipulate the textures directly.
Depending on what kind of changes you need to do you can also speed the texture manipulation up a bit using some directx magic to "directly" (in "" as in reality it will just be a copy) access the textures memory without the gamestudio stuff wrapped around it.