How to change image dimensions of a generated image from Python? Say I have an image created like so:  

 img = bpy.data.images.new('imageName',1024,1024)


Now later on I would like to change the size of this image to be something else, say 2048 X 2048.

Is there a way to change the size of the image itself without removing the image and then calling new again?



Note,  the image is used to store a baked texture so it does not matter what happens to the content of the image as it will be overwritten.
To change the size of a generated image:

img = bpy.data.images.new('imageName',1024, 1024)

# ...

img.generated_width = 2048
img.generated_height = 2048


Otherwise, call image.scale(w, h) to preserve existing pixel data.