Browse Source

fix bug in writing tiff files

David Rose 22 years ago
parent
commit
f291cb741d
1 changed files with 4 additions and 1 deletions
  1. 4 1
      panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx

+ 4 - 1
panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx

@@ -691,8 +691,11 @@ write_data(xel *array, xelval *alpha) {
     // This call is a bit of fakery to convert our proper 2-d array of
     // This call is a bit of fakery to convert our proper 2-d array of
     // xels to an indirect 2-d array of pixels.  We make it look like a
     // xels to an indirect 2-d array of pixels.  We make it look like a
     // single row of _x_size * _y_size pixels.
     // single row of _x_size * _y_size pixels.
+
+    // We can't actually write palettes bigger than 256 colors,
+    // regardless of the number of colors we can read.
     chv = ppm_computecolorhist( (pixel **)&array, _x_size * _y_size, 1,
     chv = ppm_computecolorhist( (pixel **)&array, _x_size * _y_size, 1,
-                                TIFF_COLORMAP_MAXCOLORS, &colors );
+                                256, &colors );
     if ( chv == (colorhist_vector) 0 ) {
     if ( chv == (colorhist_vector) 0 ) {
       pnmimage_tiff_cat.debug()
       pnmimage_tiff_cat.debug()
         << colors << " colors found; too many for a palette.\n"
         << colors << " colors found; too many for a palette.\n"