File fotoxx-tiffsave1.patch of Package fotoxx

--- f.file.cc.orig	2015-04-08 16:36:44.000000000 +0200
+++ f.file.cc	2015-04-12 20:36:53.347833454 +0200
@@ -3052,18 +3052,21 @@ int PXM_TIFF_save(PXM *pxm, cchar *file,
    uint16      *tiff16;
    float       *pix;
    int         tiffstat = 0;
-   int         ww, hh, row, col, rowcc;                                    //  int not uint
-   int         nch, pm = 2, pc = 1, comp = 5;
-   char        *tiffbuff;
+   int         ww, hh, row, col, rowcc, err;                               //  int not uint
+   int         nch, pm = 2, pc = 1, comp = 32946;
+   char        *tiffbuff, *tempfile;
 
    if (ftf) {
       TIFFSetWarningHandler(tiffwarninghandler);                           //  intercept TIFF warning messages
       ftf = 0;
    }
 
+   tempfile = zstrdup(file,20);                                            //  temp file in same directory
+   strcat(tempfile,"-temp.tif");
+
    *file_errmess = 0;
 
-   tiff = TIFFOpen(file,"w");
+   tiff = TIFFOpen(tempfile,"w");
    if (! tiff) {
       snprintf(file_errmess,999,"TIFF file write error: %s",file);
       printz("%s\n",file_errmess);
@@ -3079,7 +3082,8 @@ int PXM_TIFF_save(PXM *pxm, cchar *file,
    TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, nch);
    TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, pm);                            //  RGB
    TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, pc);
-   TIFFSetField(tiff, TIFFTAG_COMPRESSION, comp);                          //  LZW
+   TIFFSetField(tiff, TIFFTAG_COMPRESSION, comp);                          //  Deflate
+   TIFFSetField(tiff, TIFFTAG_ZIPQUALITY, 1);                              //  Deflate Level 1
 
    rowcc = TIFFScanlineSize(tiff);
    tiffbuff = (char*) zmalloc(rowcc);
@@ -3122,8 +3126,20 @@ int PXM_TIFF_save(PXM *pxm, cchar *file,
 
    TIFFClose(tiff);
    zfree(tiffbuff);
-
-   if (tiffstat == 1) return 0;
+   
+   if (tiffstat == 1) 
+   {
+      snprintf(command,ccc,"tiffcp -s -r 1 -c zip:p9 \"%s\" \"%s\" ",tempfile,file);  //  tiffcopy temp file to file
+      err = system(command);
+      remove(tempfile);                                                    //  delete temp file
+      free(tempfile);
+      if (err) {
+	 snprintf(file_errmess,999,"tiffcp write error: %s",tmpfile);
+      }
+      else {
+         return 0;
+      }
+   }
    snprintf(file_errmess,999,"TIFF file write error: %s",file);
    printz("%s\n",file_errmess);
    return 2;
openSUSE Build Service is sponsored by