Hi Guys,

I wrote some Raw-Image-Reader and most of it works. But I still cant figure out how to set the colortable correctly. So first of all here is my code example:

QFile file(":/new/1.raw"); //open file dialog
if(file.open(QIODevice::ReadOnly)){qDebug("File opened");}
else{qDebug("File not opened");}

QByteArray ba=file.readAll(); //read file into bytearray

QImage image(512,256,QImage::Format_Indexed8); //setup the blank image for pixel transfer later

QVector<QRgb> colorTable; //setup the 8 bit grayscale colortable
for(int i=0;i<256;i++) colorTable.push_back(qRgb(i,i,i));

image.fill(0); //just displaying a blank image here
QPixmap pix1(QPixmap::fromImage(image));

int j=0; //image manipulation procedure
for(int y=0;y<image.height();y++){
for(int x=0;x<image.width();x++){image.setPixel(x,y,ba.at( j)+128); j++;}} // I add +128 because the image file give me values from -128...127 it's a char

QPixmap pix2(QPixmap::fromImage(image)); //display the file image on second pixmap here

So like I said most of it works, but it displays half of the image in a very dark colors and some other parts looking extremly bright. I guess there is something wrong with the colortable. Or the second thing, I did something wrong with the file itself, maybe it is some special code. I thought it is just ascii, but my Geany-Editor encodes it with ISO-8859-1. So below is a example from the beginning of the file:

÷=!<q Üáßåçëçìñîîìà ¯Ã±Ã®Ã²Ã¶Ã±Ã¶Ã¸Ã¸Ã¿ÃºÃ¹Ã¼ øýüûýÿÿÿÿÿÿÿà ¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿ ÿÿÿÿÿÿÿÿÿÿÿÿà ¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿ ÿÿÿÿÿÿÿÿÿÿÿÿà ¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¿Ã¹Ã¿ÃºÃ´ æêèçÜÙØ×ØÔÒà Ã‰ÃÃˆÃ…ÇËÈÃÆÄà ‚ÁÂÂÅÈÍÏÑÈÇà …ÇÍÑÓÓÏÒ×Ùà ÚÝà âáâáäÜåçè *îîòóöÿÿûÿÿÿà ûÿÿÿÿÿÿÿÿÿÿÿ ¿Ã¿Ã¿

Hope someone got a hint for me to set the display correct, so that my Raw-Image-Reader is finished.

Best reagrds,