/* -*- C++ -*- * File: unprocessed_raw.cpp * Copyright 2009 Alex Tutubalin * Created: Fri Jan 02, 2009 * * LibRaw sample * Generates unprocessed raw image: with masked pixels and without black subtraction * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #include #include #include #ifndef WIN32 #include #else #include #endif #include "libraw/libraw.h" #ifdef WIN32 #define snprintf _snprintf #endif int main(int ac, char *av[]) { int i, ret; int verbose=1,autoscale=0; char outfn[1024],thumbfn[1024]; LibRaw RawProcessor; if(ac<2) { usage: printf( "unprocessed_raw - LibRaw %s sample. %d cameras supported\n" "Usage: %s [-q] [-A] [-g] [-s N] [-N] raw-files....\n" "\t-q - be quiet\n" "\t-s N - select Nth image in file (default=0)\n" "\t-g - use gamma correction with gamma 2.2 (not precise,use for visual inspection only)\n" "\t-A - autoscaling (by integer factor)\n" "\t-N - no raw curve\n" ,LibRaw::version(), LibRaw::cameraCount(), av[0]); return 0; } #define P1 RawProcessor.imgdata.idata #define S RawProcessor.imgdata.sizes #define C RawProcessor.imgdata.color #define T RawProcessor.imgdata.thumbnail #define P2 RawProcessor.imgdata.other #define OUT RawProcessor.imgdata.params OUT.document_mode=2; OUT.output_bps=16; OUT.output_tiff=1; OUT.user_flip=0; OUT.no_auto_bright = 1; OUT.filtering_mode=(LibRaw_filtering)( LIBRAW_FILTERING_NOBLACKS|LIBRAW_FILTERING_NOZEROES); for (i=1;i0 && max< 1<<15) { scale = (1<<16)/max; if(verbose) printf("Scaling with multiplier=%d (max=%d)\n",scale,max); for(int j=0; j