Home : Annotations : Storage : Save and retrieve an image with XMP Annotations
Q10078 - HOWTO: Save and retrieve an image with XMP Annotations

With DotImage Document Imaging, XMP annotations can be stored and loaded from a TIFF or JPEG image.  Saving annotations to XMP and embedding into an image requires setting the XMP property of the TIFF or JPEG codec.  The following is a VB example of saving an image with Annotations using the SaveFileDialog to specify the filename.

Dim xmpBytes As Byte() = Me.AnnotateViewer1.Annotations.Save()
Dim tiff As Codec.TiffEncoder = New Codec.TiffEncoder(Codec.TiffCompression.Group4FaxEncoding)
tiff.Xmp = xmpBytes
Dim fs As SaveFileDialog = New SaveFileDialog
If fs.ShowDialog(Me) = DialogResult.OK Then
     Me.AnnotateViewer1.Save(fs.FileName, tiff)
End If

To load the image with annotations back into the Viewer, use the XMP Parser as follows:

Dim fd As OpenFileDialog = New OpenFileDialog
If fd.ShowDialog(Me) = DialogResult.OK Then
     Me.AnnotateViewer1.Open(fd.FileName)
     Dim parse As XmpParser = New XmpParser
     Dim xmpData As Byte() = parse.BytesFromImage(fd.FileName)
     Me.AnnotateViewer1.Annotations.Load(xmpData, Atalasoft.Imaging.Annotate.AnnotationDataFormat.Xmp)
End If

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2017. InstantASP Ltd. All Rights Reserved