'elementCount is not the right size

Hi,
I am getting this error when I call method GetData on object Texture2D in order to load an image :
'elementCount is not the right size,elementCount * sizeof(T) is 37620, but data size is 36936.
Parameter name: elementCount

my problem is that how the image should be in order to work , I had some images in game that it worked and now I am modifying the image and resizing them and I save them with GIMP ,I tried different settings for export but every image which has been resized will hit this problem, my question is that is there any relations between height and width of image ?
thanks

1 Like

Try this:

var data = Color[texture.Width * texture.Height];
texture.GetData(data);

Data will now contain the color data for the texture.

Hope this helps,

pherbeas