Possible inconsistencies in codebase?

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

Possible inconsistencies in codebase?

Post by iansml » Mon Apr 27, 2009 2:31 pm

Hi Alex,

I'm not sure if I have found some inconsistencies in the codebase or if it's just a misunderstanding on my part. Can you please have a look and tell me if I'm doing something wrong?

The problems I have been having are related to how the VintasoftImage and ImageViewerBase.Images[x] objects work together.

1. Saving images using BaseEncoder

Code: Select all

EncoderBase encoder = null;
... //do some work to instantiate encoder as PdfEncoder or TiffEncoder and set compression
This works for single images:

Code: Select all

VintasoftImage img = imageViewer1.Images[i] as VintasoftImage;
img.Save(fullPath, encoder);
But it doesn't for collections:

Code: Select all

imageViewer1.Images.Save(fullPath, encoder);
- won't compile, method signature not recognised despite it being valid as far as Intellisense is concerned.

You have to cast it instead:

Code: Select all

imageViewer1.Images.Save(fullPath, (PdfEncoder)encoder);
Why is this the case?

2. Saving images with annotations

A similar thing happens when saving images with annotations. This code saves images and annotations together in a multipage TIFF:

Code: Select all

imageViewer1.Images.Save(fullPath, (TiffEncoder)encoder);
But this code for a single image doesn't save annotations:

Code: Select all

VintasoftImage img = imageViewer1.Images[i] as VintasoftImage;
img.Save(fullPath, encoder);
Thanks.

Ian

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

Re: Possible inconsistencies in codebase?

Post by Alex » Mon Apr 27, 2009 4:34 pm

Hi Ian,

ImageCollection is a collection of images so it can be saved only to multipage image file, i.e.TIFF or PDF file. Image collection cannot be saved to single PNG or BMP file because these formats does not support storing of multiple images in file.

Best regards, Alexander

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

Re: Possible inconsistencies in codebase?

Post by iansml » Mon Apr 27, 2009 5:33 pm

OK, thanks for the clarification about the difference between ImageCollection and the VintasoftImage. However, I'm not sure why this would cause the inconsistencies I have detailed above.

1. Why do you have to cast the BaseEncoder when saving the ImageCollection but you don't have to cast the BaseEncoder when you save the VintaSoft image, despite them having the same method signatures?
2. Why is it that when you save a multipage Tiff via the ImageCollection, the annotations are ALWAYS saved, but when you save the VintasoftImage they are not - you have to save them separately?

Also, is there any way you can save an annotated multipage Tiff as separate XMP and TIF files?

Thanks for all your help Alex!

Ian

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

Re: Possible inconsistencies in codebase?

Post by Alex » Tue Apr 28, 2009 8:34 am

Hi Ian,
Why do you have to cast the BaseEncoder when saving the ImageCollection but you don't have to cast the BaseEncoder when you save the VintaSoft image, despite them having the same method signatures?
I'm not sure that I have understood the question, please explain.
Why is it that when you save a multipage Tiff via the ImageCollection, the annotations are ALWAYS saved, but when you save the VintasoftImage they are not - you have to save them separately?
ImageCollection can be linked with AnnotationController and this allows to use images with annotations. Separate VintasoftImage object cannot be linked with annotations.
Also, is there any way you can save an annotated multipage Tiff as separate XMP and TIF files?
You can save annotation collection as XMP file using the Save method of the AnnotationCollection class.

You should save each VintasoftImage object from ImageCollection separately if you want to save images without annotations.

Best regards, Alexander

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest