I have 2 .tiff image files and I want to merge them into one .tiff file. I use TIffBitmapEncoder. I use TiffBitmapDecoder to decode the file memory stream and add to encoder.Frames.
When I try to use the encoder to Save() to the output filestream, I get an argument exception saying “The image has corrupted metadata header.” with an inner exception “The image metadata header is unrecognized.”
Load the input memory stream into a bitmap and save it to another temporary memory stream. It seems to fix the header. Then you use this fixed memory stream for the decoder.
Below is some of my partial code. You need to create the output filestream and close all the memory stream and dispose, etc.