So as you can read in comp.windows.x - i have fixed some problems .. Now i think there is only a problem with the jpegstuff (bits are not correctly arranged). So the XIMageproblem should be fixed now.. If have some problems with the libjpeg (never programmed with that ..) So maybe we can solve this problem together .. if (cinfo.output_components == 3) { for (y = 0; y < h; y += cinfo.rec_outbuf_height) { for (i = 0; i < cinfo.rec_outbuf_height; i++) { line[i] = ptr; ptr += 4 * w; /*read only 3 bits and forget the fourth */ } jpeg_read_scanlines (&cinfo, line, cinfo.rec_outbuf_height); } } what we have to do is to write into the allocated memory the bits in the order as you can see in for (g = 0; g < 254; g++) { data[4 * g * wide + 4 * g] = (char) g; data[4 * (g+5) * wide + 4 * g+1] = (char) g; data[4 * (g+10) * wide + 4 * g+2] = (char) g; } this is the red green blue line .. the forth bit is not necessary to set, so we should not write there anything .. maybe you can explain me what cinfo.output_components and cinfo.rec_outbuf_height) is and how it works .. Greetings Markus Meisinger (Chloros)