Opengl image manipulation inside Blender

Hello,
I try to manipulate (rotate, scale and multiple copy) an image inside Blender.
And doing it with Python is really slow.

I try to do it using the bgl module and it works quite well, but I have a problem:
How to return the manipulated image?

The (0,0) coordinate with the bgl.glReadPixels function is always the origin of the Blender screen and not only of the context area (3Dview or a panel like in the example).

The Blender screen before
The Blender screen after
bgl.glReadPixels(0,0,256,256,[…],buff)


import bpy,bgl
def quad2D(self,context):
    global buff,img
 
    bgl.glColor3f (1.0, 1.0, 1.0)
    bgl.glEnable(bgl.GL_TEXTURE_2D)
    bgl.glBindTexture (bgl.GL_TEXTURE_2D, img.bindcode)
 
    # Draw a textured quad
    bgl.glBegin (bgl.GL_QUADS)
    bgl.glTexCoord2f (0.0, 0.0)
    bgl.glVertex3f (0.0, 0.0, 0.0)
    bgl.glTexCoord2f (1.0, 0.0)
    bgl.glVertex3f (256.0, 0.0, 0.0)
    bgl.glTexCoord2f (1.0, 1.0)
    bgl.glVertex3f (256.0, 256.0, 0.0)
    bgl.glTexCoord2f (0.0, 1.0)
    bgl.glVertex3f (0.0, 256.0, 0.0)
    bgl.glEnd ()
 
    # [...] do something
    #
    # do something [...]
 
    # Read result
    bgl.glReadPixels(0,0,256,256,bgl.GL_RGBA,bgl.GL_FLOAT,buff)
def loadTex():
    global img
    img.gl_load(bgl.GL_NEAREST,bgl.GL_NEAREST)
    bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MAG_FILTER, bgl.GL_LINEAR)
 
class OBJECT_PT_hello(bpy.types.Panel):
    bl_label = "Hello World Panel"
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    bl_context = "object"
    def draw(self, context):
        self._handle = context.region.callback_add(quad2D, (self, context), 'POST_PIXEL')
 
def register():
    bpy.utils.register_class(OBJECT_PT_hello)
def unregister():
    bpy.utils.unregister_class(OBJECT_PT_hello)
if __name__ == "__main__":
    img = bpy.data.images["myImg"]
    buff = bgl.Buffer(bgl.GL_FLOAT,img.size[0]*img.size[1]*4)
    loadTex()
    register()