Currently, I try to create *.tga image for a single colour image which matches to the GIMP generated TGA image file. Tries several algorithms but I couldn't get exact output. Is there any standard library which I can use?
The company I work for has a C/C++ library for Windows that supports many image formats, including TGA RLE. Although it’s not open source, there’s a fully-working free evaluation you can try and see if the output files match what you’re looking for.
The C++ code to save a TARGA RLE file looks like this:
BITMAPHANDLE bmp = {0};
L_LoadBitmap("G:\\test\\input.bmp", &bmp, sizeof bmp, 0, ORDER_BGRORGRAY, NULL, NULL);
L_SaveBitmap("G:\\test\\output.tga", &bmp, FILE_TGA_RLE, bmp.BitsPerPixel, 0, NULL);
L_FreeBitmap(&bmp);
You can obtain the evaluation from this page.