Save annotations separately in Multipage TIFF?
Posted: Thu Apr 30, 2009 2:43 pm
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:
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
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);
}
}
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