Please make sure your files have ROWSPERSTRIP tag set.
Without this tag set, JPEG decoder might assume that height of strips in your image is incorrect.
Other option is to download source code of LibTiff.Net, set breakpoint at the beginning of JPEGPreDecode
method in JpgeCodec.cs and see what goes wrong. Most probably, the following part of the method is causing the warnings and misbehaving of the codec:
if (segment_height > td.td_rowsperstrip)
segment_height = td.td_rowsperstrip;
You might change this part of the method but it might be better to fix the files instead.
You might also try to add the tag yourselves (please note that you will need to set tag for each directory). Open the image, check the presence of the tag and try setting the correct value for the tag using 'SetField' method.
using (Tiff image = Tiff.Open(existingTiffName, "a"))
{
for (int i = 0; i < image.NumberOfDirectories(); i++)
{
image.SetDirectory(i);
...
FieldValue[] value = image.GetField(TiffTag.ROWSPERSTRIP);
if (value == null)
{
// ROWSPERSTRIP is not set
image.SetField(TiffTag.ROWSPERSTRIP, heightOfTheImage);
}
...
}
}
Please note that you should open image in append more (use "a"
parameter for this).