Converting .bmp into array of pixel information

Hello,

I am new to using root and am trying to take a bitmap image and turn it into an array with its RGB values. From there I plan to make a 2-D histogram of the image and apply different fits to it. Currently, I am using the GetArgbArray() function and I seem to be on the right track. I have looked at the example to make the image transparent. My code right now opens the image, gets the image height/width, turns it into an array and then shows me the pixels height, width, and the result from GetArgbArray.

The problem that I am running into is twofold. First, the return of GetArgbArray gives me the memory location of the hex RGB code. The only way I have been able to view the actual hex code is by accessing the memory location in the root terminal. Secondly, I am having trouble writing the array to a file for future use.

Please let me know if this is the best path to take and any help regarding to my questions. My code is as follows:

[code]#include <TStyle.h>
#include <TColor.h>

UInt_t rgbarray()
{
TASImage * atta=TImage::Open(“ATTA.bmp”); //Opens image
UInt_t w = atta->GetWidth(); //Gets height of image
UInt_t h = atta->GetHeight(); // Gets width of image
UInt_t*argb= atta->TASImage::GetArgbArray(); // Creates RGB array

for (UInt_t i=0; i<h;i++) //Loop to access each pixel (height)
{
	for (UInt_t j=0; j<w;j++) // loop to access each pixel (width)
	{
		Int_t idx = i*w + j;
	    col = argb[idx]  & 0xffffff; //defines pointer to array and restricts format of hex code
		
		if (col !=0) // eliminates the black space in the image
		{
			cout << i <<" " <<j<< " " <<col<< endl; // prints pixel height, width, and RGBarray result
		}
		
	}
}

}
[/code]

Thanks,
Chris

Yes, TASimage is the right tool to use to do that sort of things.