Save annotations separately in Multipage TIFF?

Questions, comments and suggestions concerning VintaSoft Annotation .NET Plug-in.

Moderator: Alex

Post Reply
iansml
Posts: 31
Joined: Thu Apr 23, 2009 1:57 pm

Save annotations separately in Multipage TIFF?

Post by iansml »

Hi Alex,

We like the ability of your components to save annotations as separate XMP files and have a business case where this would be very useful. I've got this working for single-image TIFF files using the following code:

Code: Select all

//save files
for (int i = 0; i < imageViewer1.Images.Count; i++)    
{          
    //save each image as single file
    VintasoftImage img = imageViewer1.Images[i] as VintasoftImage;
    string newImageFileName = string.Format("{0}_{1}{2}", fileName, i.ToString().PadLeft(4, '0'), fileExt);
    if (encoder != null)
    {
        img.Save(newImageFileName, encoder);
     }
     else
     {
         img.Save(newImageFileName);
     }

     if (saveAnnotationsToolStripMenuItem.Checked)
     {
          //save annotations
          SaveAnnotations(i, ChangeFileExtension(newImageFileName, EXT_XMP));
     }
}   ...

private void SaveAnnotations(int imageIndex, string filePath)
{
    if (imageViewer1.Annotations[imageIndex].Count > 0)
    {
        XmlDocument doc = imageViewer1.Annotations[imageIndex].Save();
        doc.Save(filePath);
     }
}
The problem I have is that I can't get this working with multipage TIFF's. As far as I'm aware, I can only save multipage TIFFs by calling Save() on an ImageCollection. But when you do this, it ALWAYS saves the annotations (apparently within the TIFF file as I can't see a separate XMP file - is that correct?). What I want to do is:

1. Save all images in ThumbnailViewer as a Multipage TIFF without annotations
2. Save all images in ThumbnailViewer as a Multipage TIFF with separate XMP file
3. Save selected images in ThumbnailViewer as a Multipage TIFF without annotations
4. Save selected images in ThumbnailViewer as a Multipage TIFF with separate XMP file

Is this possible? If so, can you provide me with some example code for each of these requirements?

Thanks,

Ian
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Save annotations separately in Multipage TIFF?

Post by Alex »

Hi Ian,

Please see decriptions of constructors of the TiffEncoder class in documentation.

The following code will save all images to a single multipage TIFF file:

Code: Select all

TiffEncoder tiffEncoder = TiffEncoder(false);
for (int i = 0; i < imageViewer1.Images.Count; i++)    
{          
    //save each image as single file
    VintasoftImage img = imageViewer1.Images[i] as VintasoftImage;
    string newImageFileName = string.Format("{0}_{1}{2}", fileName, i.ToString().PadLeft(4, '0'), fileExt);
    img.Save(newImageFileName, tiffEncoder);
}
Best regards, Alexander
iansml
Posts: 31
Joined: Thu Apr 23, 2009 1:57 pm

Re: Save annotations separately in Multipage TIFF?

Post by iansml »

Hi Alex,

Thanks for the code, which allows me to save images without annotations. This answers requirements 1 and 3 in my original post. I don't see any code that allows you to choose whether to save the annotations in a separate XMP file though. This was essential for requirements 2 and 4 in my original post.
1. Save all images in ThumbnailViewer as a Multipage TIFF without annotations
2. Save all images in ThumbnailViewer as a Multipage TIFF with separate XMP file
3. Save selected images in ThumbnailViewer as a Multipage TIFF without annotations
4. Save selected images in ThumbnailViewer as a Multipage TIFF with separate XMP file
The ability to save annotations as separate XMP files for each image (single or multipage TIFF) is looking increasingly important to our business model. I've got this working for non-multipage TIFF files ("all" and "selected" in thumbnailviewer) but not multipage ones (requirements 2 and 4). Is it possible to do this?

Thanks, Ian
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Save annotations separately in Multipage TIFF?

Post by Alex »

Hi Ian,

I'm not sure that I have understood you. Do you want to save all annotations of multipage file into one single XMP file?

Best regards, Alexander
iansml
Posts: 31
Joined: Thu Apr 23, 2009 1:57 pm

Re: Save annotations separately in Multipage TIFF?

Post by iansml »

Yes, that's correct.
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Save annotations separately in Multipage TIFF?

Post by Alex »

Why don't you want create own format?

Best regards, Alexander
iansml
Posts: 31
Joined: Thu Apr 23, 2009 1:57 pm

Re: Save annotations separately in Multipage TIFF?

Post by iansml »

I guess my question was: "is this possible?". Can I take it from your reply that it's not? I only started working with multipage TIFF's and your Annotation controls a few weeks ago so am learning what is and isn't possible as I go along. Is this a feature that could be added in future versions of your control or is it just not possible due to multipage TIFF file format?

Thanks,

Ian
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Save annotations separately in Multipage TIFF?

Post by Alex »

You can create own proprietary format based on our XMP format.

Best regards, Alexander
Post Reply