Page 1 of 1

Change/Override Image Loading Path (XMP)

Posted: Mon Jan 23, 2012 1:29 pm
by Sami.Marzouki
Hi,

Is it possible to override the loading image process and instead get the image from database? When loading annotations from XMP file?
example when adding referenced image, I would like to save only the filename and extension in the xmp file but loading the image from database.

Kind regards,

Sami Marzouki

Re: Change/Override Image Loading Path (XMP)

Posted: Mon Jan 23, 2012 2:39 pm
by Alex
Hello Sami,

Yes, you can store image and annotations separately.

Annotation collection associated with the image can be loaded from file or stream using the AnnotationCollection.Load method:

Code: Select all

AnnotationViewer.Annotations[0].Load(streamWithAnnotations);
Annotation collection associated with the image can be saved to file or stream using the AnnotationCollection.Save method:

Code: Select all

AnnotationViewer.Annotations[0].Save(streamWithAnnotations);
Best regards, Alexander

Re: Change/Override Image Loading Path (XMP)

Posted: Mon Jan 23, 2012 3:24 pm
by Sami.Marzouki
Alex wrote:Hello Sami,

Yes, you can store image and annotations separately.

Annotation collection associated with the image can be loaded from file or stream using the AnnotationCollection.Load method:

Code: Select all

AnnotationViewer.Annotations[0].Load(streamWithAnnotations);
Annotation collection associated with the image can be saved to file or stream using the AnnotationCollection.Save method:

Code: Select all

AnnotationViewer.Annotations[0].Save(streamWithAnnotations);
Best regards, Alexander
Hi Alex,

thank you for your fast answer.
But I'm talking of image loading in ReferencedImageAnnotation class, in the property Filename I'm storing only the filename without the path.
And from that, I would like to be able to control/overload the loading, because the images are stored in a SQL database.

Kind regards,

Sami Marzouki

Re: Change/Override Image Loading Path (XMP)

Posted: Mon Jan 23, 2012 6:45 pm
by Sami.Marzouki
Hi Alex,

I think i've found my answer, i'm going through the annotationcollection and for
ReferencedImageAnnotation.Image i'm using the method SetImage to get the image from the database.

Is that a good way of using the SDK?

Kind regards,

Sami

Re: Change/Override Image Loading Path (XMP)

Posted: Mon Jan 23, 2012 6:53 pm
by Alex
I think i've found my answer, i'm going through the annotationcollection and for
ReferencedImageAnnotation.Image i'm using the method SetImage to get the image from the database.
Is that a good way of using the SDK?
It's a good way but not the best.

The best way is create annotation class derived from ReferencedImageAnnotation and override
the Annotation.ReadXmlContent or Annotation.Deserialize method.

Please read the "Programing - Annotate images - Create a custom annotation" topic in the documentation.

Best regards, Alexander

Re: Change/Override Image Loading Path (XMP)

Posted: Mon Jan 23, 2012 7:00 pm
by Sami.Marzouki
Alex wrote:
I think i've found my answer, i'm going through the annotationcollection and for
ReferencedImageAnnotation.Image i'm using the method SetImage to get the image from the database.
Is that a good way of using the SDK?
It's a good way but not the best.

The best way is create annotation class derived from ReferencedImageAnnotation and override
the Annotation.ReadXmlContent or Annotation.Deserialize method.

Please read the "Programing - Annotate images - Create a custom annotation" topic in the documentation.

Best regards, Alexander
thank you,

I will read it and implement it that way then.

Kind regards,

Sami