--- IO/vtkPNGWriter.h.orig 2011-03-16 12:18:56.000000000 +0100 +++ IO/vtkPNGWriter.h 2011-03-16 15:41:57.000000000 +0100 @@ -51,12 +51,21 @@ virtual void SetResult(vtkUnsignedCharArray*); vtkGetObjectMacro(Result, vtkUnsignedCharArray); + // Description: + // Set/Get the zlib compression level. + // The range is 0-9, with 0 meaning no compression + // and largest image size, and 9 meaning best compression + // and smallest image size. The default is 0. + vtkSetClampMacro(CompressionLevel, int, 0, 9); + vtkGetMacro(CompressionLevel, int); + protected: vtkPNGWriter(); ~vtkPNGWriter(); void WriteSlice(vtkImageData *data); unsigned int WriteToMemory; + int CompressionLevel; vtkUnsignedCharArray *Result; FILE *TempFP; --- IO/vtkPNGWriter.cxx.orig 2011-03-16 12:18:51.000000000 +0100 +++ IO/vtkPNGWriter.cxx 2011-03-16 15:38:31.000000000 +0100 @@ -29,6 +29,7 @@ this->FileLowerLeft = 1; this->FileDimensionality = 2; this->WriteToMemory = 0; + this->CompressionLevel = 0; this->Result = 0; this->TempFP = 0; } @@ -185,6 +186,8 @@ vtkErrorMacro(<<"Unable to write PNG file!"); return; } + + png_set_compression_level(png_ptr, CompressionLevel); png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr)