I open a .tif file and I wanted to know how Windows Photo Viewer (or another viewer) determines where the front check image ends and where positions to use to display the back image of the check?

I receive a check image file from a bank.

I open this file and extract the beginning of the file, starting with position 1 that has a value "II*" and retrieve up until the position just before the next occurrence of "II*" and save this file as "bankimages.tif".  

How is it that when I open this "tif" file (in Windows Photo Viewer) that I can see the front image of the check and if I click on a navigation button on the face of the check, that the back image of the check is then displayed?

How does WIndows Photo Viewer know where the front image of the check ends and where the beginning of the back image of the check image begins?
zimmer9Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy DownsOWNERCommented:
Apparently the Tiff has multiple images in it like  this post where they want to display the images side by side. That said it's not difficult for a photo viewer to flip from one photo to the next.

An example is provided below which will extract individual images from TIFF and show them on the pictureBox

List<Image> allTiffImages = null;
int currentImageIndex = 0;

private void btnLoadTiff_Click(object sender, EventArgs e)
{
    images = new List<Image>();

    // Open a Stream and decode a TIFF image
    Stream imageStreamSource = new FileStream("filename.tif", FileMode.Open, FileAccess.Read, FileShare.Read);
    TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageStreamSource,     BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);

    foreach(BitmapSource bmpS in decoder.Frames)
    {
       Image img = new Image();
       img.Source = bmpS;
       img.Stretch = Stretch.None;
       img.Margin = new Thickness(10);

       images.Add(img);
    }

    if(images.Count > 0)
        pictureBox1.Image = images[0];
}

private void btnNextImage_Click(object sender, EventArgs e)
{
    if(++currentImageIndex >= images.Count)
        currentImageIndex = 0;   
       // 0 cycles the images,
       // if you want to stop at last image,
       //   set currentImageIndex = images.Count - 1; 

    pictureBox1.Image = images[currentImageIndex];
}

private void btnPrevImage_Click(object sender, EventArgs e)
{
    if(--currentImageIndex < 0)
        currentImageIndex = images.Count - 1;
       // images.Count - 1 cycles the images,
       // if you want to stop at first image,
       //   set currentImageIndex = 0; 

    pictureBox1.Image = images[currentImageIndex];
}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.