Can't get generated image to assign to an 'Image or Movie' type texture

I’m trying to get this image I generate with my script to be assigned to an ‘Image or Movie’ type texture.

img = bpy.ops.image.new( name = obj.name + 'Color', width = 1024, height = 1024,
        color = (0.0,0.0,0.0,0.0), alpha = True, generated_type ='BLANK')

But I keep getting the error:


Traceback (most recent call last):
  File "\SFBetter_Paint.py", line 39, in execute
    cTex.image = img
TypeError: bpy_struct: item.attr = val: ImageTexture.image expected a Image type, not set


location: <unknown location>:-1

Here’s a broader picture of the code:


#Create a new material and give it the name of the object
            mat = bpy.data.materials.new(obj.name)
            #Assign it some properties
            mat.diffuse_shader = 'LAMBERT'
            mat.darkness = 0.8
            
            #Assign Material to the active object
            obj.active_material = mat
        
        #Create transparent image to be used as texture
        img = bpy.ops.image.new( name = obj.name + 'Color', width = 1024, height = 1024,
        color = (0.0,0.0,0.0,0.0), alpha = True, generated_type ='BLANK') 
        #Pack image into Blender File
        bpy.ops.image.pack(as_png=True)
        #Create A New texture
        cTex = bpy.data.textures.new( name = obj.name + 'Color', type = 'IMAGE')
        
        #Add a texture slot and assign it the texture we just created
        mTex = mat.texture_slots.add()
        mTex.texture = cTex
        cTex.image = img

Operators don’t return objects, the only return a set to indicate whether they finished, aborted etc.:
http://www.blender.org/documentation/blender_python_api_2_70a_release/bpy.ops.html

Replace the image.new operator by this RNA method:

img = bpy.data.images.new(obj.name, 1024, 1024, alpha=True)

The default color is black, if you want to fill it with orange for instance, you can do:

img.pixels[:] = (1.0, 0.5, 0.0, 1.0) * 1024 * 1024

A million thanks to you sir. This worked perfectly.