Link to home
Start Free TrialLog in
Avatar of mainrotor
mainrotor

asked on

I need help viewing multiple page TIFF image in my WPF with VB.Net code-behind application

Hi Experts,
I have a SQL table with a field that stores binary data.  The binary data is of "muliple page TIFF" image\file.
I want to display this multiple page Tiff image\file in my WPF application, using a scroll viewer, a viewbox, and image controls.
How can I do this?

I need both XAML and VB.Net code-behind samples.

Thank you,
Avatar of darbid73
darbid73
Flag of Germany image

Hi mainrotor,

Your question is a fairly large one to answer.  Could you be a little more specific with what you are having difficulty with?

I will assume you want to write it all yourself, if however I am incorrect;
Here is a complete Example with RadControls from Telerik and another example from RasterEdge.

So now doing it yourself.
I believe that you will need to use the TiffBitmapDecoder to do this the best way.  

This is also the common way to go in other forums and in this question here too.

You can use the TiffBitmapDecoder class to load the image and then use the Frames property to access which tiff frame you like.
Avatar of mainrotor
mainrotor

ASKER

darbid73.  Thank you for your suggestions.  I will definitely check them all out.  
Yes, I do want to know how to do it myself.

Thanks.
mrotor
darbid73 and other experts,
I got the following code to work using TiffBitMapDecoder.  This works great when your file exists in a file path (like in my test code below):
My problem is that my tiff images files do not exist in a file path.  They are saved as binary code in a SQL Server table (see example of binary code below).  How can I get this binary code to work with TiffBitMapDecoder in order to get the frame count?



TEST CODE

       
 Dim imageStreamSource As New FileStream("C:\MyFiles\LETTER_A_EXAMPLE_XYZ.tif", FileMode.Open)
        Dim decoder As New TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default)
        Dim bitmapSource As BitmapSource = decoder.Frames(0)
        SVimage1.Source = bitmapSource

Open in new window


SAMPLE OF BINARY DATA

User generated image

Thanks in advance,
mrotor
I also tried this and I got an error.  Someone please tell me how to resolve this.

Thanks in advance:

Code I have tried but does not work:
User generated image
Thanks ,
mrotor
ASKER CERTIFIED SOLUTION
Avatar of Douglas Suyemoto
Douglas Suyemoto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
dsuyemoto,
I will try passing a stream and post my results.

thank you,
mrotor
Not really sure that accepted solution is the answer to your question mate.