Esempio n. 1
0
// thread routine
int process_files(void *q)
{
  int ret;
  int count = 0;
  char outfn[1024], *fn;
  libraw_data_t *iprc = libraw_init(0);

  if (!iprc)
  {
    fprintf(stderr, "Cannot create libraw handle\n");
    return -1;
  }

  while ((fn = get_next_file()))
  {

    iprc->params.half_size = 1; /* dcraw -h */
    iprc->params.use_camera_wb = use_camera_wb;
    iprc->params.use_auto_wb = use_auto_wb;
    iprc->params.output_tiff = tiff_mode;

    ret = libraw_open_file(iprc, fn);
    if (verbose)
      fprintf(stderr, "%s: %s/%s\n", fn, iprc->idata.make, iprc->idata.model);
    HANDLE_ERRORS(ret);

    ret = libraw_unpack(iprc);
    HANDLE_ERRORS(ret);

    ret = libraw_dcraw_process(iprc);
    HANDLE_ERRORS(ret);

    snprintf(outfn, 1023, "%s.%s", fn, tiff_mode ? "tif" : "ppm");

    if (verbose)
      fprintf(stderr, "Writing file %s\n", outfn);
    ret = libraw_dcraw_ppm_tiff_writer(iprc, outfn);
    HANDLE_ERRORS(ret);
    count++;
  }
  libraw_close(iprc);
  printf("Processed %d files\n", count);
  return 0;
}
Esempio n. 2
0
int main(int ac, char *av[])
{

  if (ac != 3)
  {
    fprintf(stderr, "Usage: %s <input_file> <output_file>\n %d", av[0],ac);
    exit(1);
  }


  libraw_data_t *iprc = libraw_init(0);

  if (!iprc)
  {
    fprintf(stderr, "Cannot create libraw handle\n");
    exit(1);
  }

  iprc->params.half_size = 1; /* dcraw -h */
  iprc->params.use_camera_wb = 1; /* dcraw -w */

  char outfn[1024];
  int ret = libraw_open_file(iprc, av[1]);
  HANDLE_ERROR(ret);

  printf("Processing %s (%s %s)\n", av[1], iprc->idata.make, iprc->idata.model);

  ret = libraw_unpack(iprc);
  HANDLE_ERROR(ret);

  ret = libraw_dcraw_process(iprc);
  HANDLE_ERROR(ret);

  strcpy(outfn, av[2]);
  printf("Writing to %s\n", outfn);

  ret = libraw_dcraw_ppm_tiff_writer(iprc, outfn);
  HANDLE_ERROR(ret);

  libraw_close(iprc);
  return 0;
}
Esempio n. 3
0
int main(int ac, char *av[])
{
    int i;
    libraw_data_t *iprc = libraw_init(0);

    if(!iprc)
        {
            fprintf(stderr,"Cannot create libraw handle\n");
            exit(1);
        }

    iprc->params.half_size = 1; /* dcraw -h */
	
    for (i=1;i<ac;i++)
        {
            char outfn[1024];
			int ret = libraw_open_file(iprc,av[i]);
            HANDLE_ALL_ERRORS(ret);
            
            printf("Processing %s (%s %s)\n",av[i],iprc->idata.make,iprc->idata.model);

            ret = libraw_unpack(iprc);
            HANDLE_ALL_ERRORS(ret);

            ret = libraw_dcraw_process(iprc);
            HANDLE_ALL_ERRORS(ret);
            
            strcpy(outfn,av[i]);
            strcat(outfn,".ppm");
            printf("Writing to %s\n",outfn);

            ret = libraw_dcraw_ppm_tiff_writer(iprc,outfn);
            HANDLE_FATAL_ERROR(ret);
        }
    libraw_close(iprc);
    return 0;
}