Cef
Cef

Reputation: 929

BitMiracle Tiff.ClientOpen() Fails

I am trying to open an image byte array with the Tiff.ClientOpen method as follows:

 using (MemoryStream ms = new MemoryStream(img))
 {
     using (Tiff input = Tiff.ClientOpen("InMemory", "r", ms, new TiffStream()))
     {

     }
 }

Where img = byte[].

But inside my second 'using' input = null. I am 100% sure img has data, and stepping through the debug process it even worked a few times.

Has anyone experienced this?

Upvotes: 1

Views: 1142

Answers (2)

Joe
Joe

Reputation: 2601

Replace InMemory with in-memory, and make sure you selected a valid image.

using (Tiff image = Tiff.ClientOpen("in-memory", "r", ms, new TiffStream()))

Upvotes: 0

Cef
Cef

Reputation: 929

Seems like the issue is with the format of the tiff I am reading into the memory stream. By using the library to create a tiff as shown in the example here:

https://bitmiracle.github.io/libtiff.net/?topic=html/e4f25423-eede-4ef6-a920-9cb539d056c6.htm

then passing the result of that to the memory stream, after that then the ClientOpen() works. Not sure why. This is when you wish BitMiracle provided support ;).

Upvotes: 1

Related Questions