Home Technical Talk

Maya API Help: Reading, Writing to TGA File

corvoconn
null
Hello, I'm writing a plugin in Maya 2018 that both reads and writes data to a TGA file.  My plugin creates the TGA if it doesnt exist, otherwise it will read from and overwrite parts of the image.  

My problem is that consistently, when I read from the file, the first four pixels are always garbage data. so I lose those first four pixels. Does anyone know if there is a TGA reason for this? 

<div>MImage newImage;</div><div>newImage.create( WIDTH, HEIGHT, DEPTH, MImage::kByte);
unsigned char* textureData = new unsigned char[WIDTH*HEIGHT*DEPTH];
if (MStatus::kSuccess == newImage.readFromFile(textureFileName))
{
     textureData = newImage.pixels();
}<br></div>

Replies

Sign In or Register to comment.