use Imager 0.48; # this assumes you've created an image of the right # size first. # if you call it with too large an image for the data # supplied then it will crash use Inline C => <<'EOS' => WITH => 'Imager'; void capture2image(Imager::ImgRaw out, unsigned char *data) { i_color *line_buf = mymalloc(sizeof(i_color) * out->xsize); i_color *pixelp; int x, y; for (y = 0; y < out->ysize; ++y) { pixelp = line_buf; for (x = 0; x < out->xsize; ++x) { pixelp->rgba.b = *data++; pixelp->rgba.g = *data++; pixelp->rgba.r = *data++; ++pixelp; } i_plin(out, 0, out->xsize, y, line_buf); } myfree(line_buf); } EOS