Ignacio Vico wrote: > Hi, > > I'm programing an application for getting images, I've set the acquisition > but my trouble now is to save the images i have acquired. I must save them > in JPEG with low resolution (for a web application) and a format that > haven't loss of information (such TIFF, GIF, PNG, BMP etc) > > I would like to know were can I find libraries for do this. libjpeg, libpng? Both libraries come with docs and sample code. Both are standard for every linux disttibution. Writing out RGB data as jpeg using libjpeg is pretty easy: ------------------- cut here -------------------- static int write_file(int fd, char *data, int width, int height) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; FILE *fp; int i; unsigned char *line; fp = fdopen(fd,"w"); cinfo.err = jpeg_std_error(&jerr); jpeg_create_compress(&cinfo); jpeg_stdio_dest(&cinfo, fp); cinfo.image_width = width; cinfo.image_height = height; cinfo.input_components = 3; cinfo.in_color_space = JCS_RGB; jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo, grab_quality, TRUE); jpeg_start_compress(&cinfo, TRUE); for (i = 0, line = data; i < height; i++, line += width*3) jpeg_write_scanlines(&cinfo, &line, 1); jpeg_finish_compress(&(cinfo)); jpeg_destroy_compress(&(cinfo)); fclose(fp); return 0; } ------------------- cut here -------------------- Gerd -- #define ENOCLUE 125 /* userland programmer induced race condition */