문제

I need to create a b/w, g4-compressed multipage tiff from some b/w singlepage tiff-files. The offset of the first directory needs to be 8.

I'm able to create the multipage tiff, but the offset of the first directory is always greater than 8.

I've some sample tiff files that have a directory offset of 8 for the first directory. So it seems to be possible, but I have no idea how to do this with libtiff.net.

I've also a piece of code using gdi+ for creating the tiff, that also has offset = 8, but gdi+ has some limitations and I can't use it.

Can I do this with libtiff.net or are there other tiff libaries out there to do this?

Thanks Tobias

도움이 되었습니까?

해결책

It's definitely possible with LibTiff.Net.

In order to get directory be placed before raster data you should use CheckpointDirectory method.

Your code should look something like this:

using (Tiff tif = Tiff.Open("multipage.tif", "w"))
{
   //...
   tif.SetField(..);
   //...
   tif.SetField(..);
   tif.CheckpointDirectory();

   //...
   tif.WriteScanline(..);
   //...
}

Of course, you are not limited to using WriteScanline method. Any other method that writes raster data will do too. The key point is to call CheckpointDirectory method first.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top