ClausKleber Posted May 13, 2014 Share Posted May 13, 2014 Hi, i'm trying to save an image or rather a PXL_Raster to a file but there will be no genereted file. IMG_File *tex = IMG_File::open("D:/test.png"); UT_PtrArray<PXL_Raster *> images; tex->readImages(images); // First try if (IMG_File::saveRasterAsFile("D:/new.png", images[0])) cout << "Success!" << endl; // is not called // Second try if (tex->writeImages(images)) cout << "Success!" << endl; // is also not called tex->close(); delete tex; What i'm doing wrong? Has someone a tip for me? Thanks! Quote Link to comment Share on other sites More sharing options...
malexander Posted May 13, 2014 Share Posted May 13, 2014 Have you checked to see if images has any entries? The [] brackets will create entry zero for you (as NULL), so it's better to use images(0) when you're doing a read access to the array. Also, make sure you have write access to D:/. Finally, if nothing else works, try writing a .pic file to see if it's a png-specific issue. The second attempt will definitely not work because tex is a IMG_File handle opened for read. Quote Link to comment Share on other sites More sharing options...
ClausKleber Posted May 14, 2014 Author Share Posted May 14, 2014 Thanks for the images(0) tip. I will do that. I have figured out that the problem was caused by the non-commercial version of Houdini. The IMG_File::saveRasterAsFile() method accepts only 768x576 px images in the nc-version. My code works well for smaller images. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.