Hi all,

I need to display a tiff image on a QWidget, the image is 8 bit-depth, and I need to represent it using 2 dimensional unsigned char so that it can be processed later. I've successfully read the tiff image into the char, but I can't draw it on the QWidget. What I've tried is:

Qt Code:
  1. unsigned char pic[512][512] = TiffIO::tiffReadPic("test.tif", pic, &width, &height);
  2. QImage img(width, height,QImage::Format_Indexed8);
  3.  
  4. for(int i = 0; i < 255; i++)
  5. {
  6. myColor = qRgb(i, i, i);
  7. img.setColor(i, myColor);
  8. }
  9.  
  10. for(int i = 0; i<width; i++)
  11. for(int j = 0; j<height; ++j)
  12. img.setPixel(i, j, pic[i][j]);
To copy to clipboard, switch view to plain text mode 

But it doesn't give anything, the QWidget remains blank and no error message at all

Any suggestion?

Thanks...