vtkPNGWriter writes invalid image on Update()
Multiple VTK users ran into the issue that vtkPNGWriter (and similar writers) generate invalid output files if their Update()
method is called instead of their Write()
method. See for example here. It is quite confusing because the documentation does not explicitly describe this and if call Update()
then there is no error message and some file is generated (it is just invalid).
The root cause of the issue is that vtkImageWriter
implements file writing in RequestData()
method, while most writers implement it in Write()
method.
Probably the best would be to update writers to work similarly to vtkImageWriter
(write on Update()
) because then writers would work the same way as all other filters. Write
method could be still kept for backward compatibility but it would just call RequestData()
method (via UpdateWholeExtent()
).