how to get pixeldata 16bit tiff

Hello all,

this is my first post on the forum. I’m starting to use openFrameworks (have programming experience in Java but not really in OpenGL) and lot’s of things are still a bit unclear :wink:

For a project I’m working on now, I need to access the pixel value of a 16bit tiff image (one channel).
I’ve been searching on the forum and I suppose that an ofImage loads it correctly as 16bit, but ofColor(x,y) doesn’t return any correct value (which should be between 0 - 65535) I’ve been messing around now for a while but don’t really get there…

Can somebody help me out here?

	// loop through the image in the x and y axes  
	int skip = 1; // load a subset of the points  
	for(int y = 0; y < 1080; y += skip) {  
		for(int x = 0; x < 2320; x += skip) {  
            ofColor current = img.getColor(x,y);  
            cout << "value: " << current << "\n";   


a bit different logic but does this give you different values?

for (int i=0; i<width; i++)   
	for (int j=0; j<height; j++)  
		int pos = (j * width + i);  
		cout << "value: " << (int)img.getPixels()[pos] << endl;