Merging Wang-annotated TIFF into jpeg

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

mbauxd
Posts: 9
Joined: Fri Feb 26, 2016 1:27 pm

Merging Wang-annotated TIFF into jpeg

Post by mbauxd » Fri Feb 26, 2016 1:31 pm

Hello people,

I am currently evaluating the Imaging SDK for a project, and have encountered a problem. I load a Wang-annotated TIFF, which shows the annotations in the WPF demo just fine. And then I want to save it, baking in the annotations to the image. But when I open the saved jpg file, the annotations are not in it.

Code: Select all

VintasoftImage vsImage = new VintasoftImage(filename);

JpegEncoder je = new JpegEncoder();
je.Settings.CreateThumbnail = true;
je.Settings.AnnotationsFormat = AnnotationsFormat.VintasoftXmp | AnnotationsFormat.VintasoftBinary;
je.Settings.CopyExifMetadata = true;
je.Settings.CopyUnknownApplicationMetadata = true;
je.Settings.CreateThumbnail = false;
je.Settings.GenerateOptimalHuffmanTables = false;
je.Settings.Quality = 100;
je.Settings.SaveComments = true;

je.AnnotationsFormat = AnnotationsFormat.VintasoftXmp | AnnotationsFormat.VintasoftBinary;

string jpegName = String.Format("{0}.jpg", Path.GetFileNameWithoutExtension(filename));

vsImage.Save(jpegName, je);
I read some stuff about SetSaveAnnotaions(true), but that doesnt seem to exist anymore. Anyone here who might be able to help?

Thanks in advance, much appreciated!

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

Re: Merging Wang-annotated TIFF into jpeg

Post by Alex » Fri Feb 26, 2016 2:41 pm

Hello,

You have not loaded image and annotations in memory - in this case encoder copies image data without loading the whole image into memory. Also encoder copies annotations as metadata if encoder supports annotations metadata format. JPEG encoder does not support WANG annotations and it does not copies annotations.

For copying WANG annotation from TIFF file into JPEG file you need load annotations into memory:

Code: Select all

ImageCollection images = new ImageCollection();
images.Add("test.tif");

AnnotationDataController annoDataController = new AnnotationDataController(images);
// load annotations into memory - after this step encoder will be able to get "unpacked" annotations
// from memory and save annotations to the necessary format
AnnotationDataCollection annoDataCollection = annoDataController[0];

JpegEncoder jpegEncoder = new JpegEncoder();
jpegEncoder.AnnotationsFormat = AnnotationsFormat.VintasoftXmp;
images[0].Save("test.jpg", jpegEncoder);
Best regards, Alexander

mbauxd
Posts: 9
Joined: Fri Feb 26, 2016 1:27 pm

Re: Merging Wang-annotated TIFF into jpeg

Post by mbauxd » Fri Feb 26, 2016 3:05 pm

Wow, thanks for the quick response!

Is there a way to bake these into the image using the SDK? Right now, I can only see the annotations when I open the JPG with the supplied tool.

Br

mbauxd
Posts: 9
Joined: Fri Feb 26, 2016 1:27 pm

Re: Merging Wang-annotated TIFF into jpeg

Post by mbauxd » Fri Feb 26, 2016 5:29 pm

Code: Select all

WpfAnnotationViewController wavc = new WpfAnnotationViewController(annoDataController);
wavc.BurnAnnotationCollectionOnImage(images[0]);
Nevermind, I got it using the above code. Thanks for the good support!

mbauxd
Posts: 9
Joined: Fri Feb 26, 2016 1:27 pm

Re: Merging Wang-annotated TIFF into jpeg

Post by mbauxd » Wed Mar 15, 2017 11:57 am

Sorry for reviving an old thread here, but there is another problem.

When converting TIFF files to PNG, rectangle annotations work fine (color/alpha and shape) but line annotations are not interpreted correctly. In the original, the lines are transparent with rounded corners, but in the result PNG produced via VintasoftImaging, these lines are NOT transparent and do not have rounded edges. While I personally don't care whether the edges are round or corners (and I'm pretty sure the customer won't either), the missing transparency causes these annotations to cover up important text.

Is this a known bug in version 8.3? Right now I unfortunately don't have access to the originals to attach an image, but maybe this description can already help.

Thanks!

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

Re: Merging Wang-annotated TIFF into jpeg

Post by Alex » Wed Mar 15, 2017 2:43 pm

Hello,

Could you send us (to support@vintasoft.com) a small working project, which demonstrates your problem? We need reproduce the problem on our side.

Best regards, Alexander

mbauxd
Posts: 9
Joined: Fri Feb 26, 2016 1:27 pm

Re: Merging Wang-annotated TIFF into jpeg

Post by mbauxd » Wed Mar 15, 2017 3:53 pm

I'll get some samples to you next week, when I have access to them again. Thanks for the response!

mbauxd
Posts: 9
Joined: Fri Feb 26, 2016 1:27 pm

Re: Merging Wang-annotated TIFF into jpeg

Post by mbauxd » Wed Mar 22, 2017 11:33 am

Small update, it will take another week for me to get you the samples, since I don't have the software needed yet, to create some sample files for you to use. Once I do, I will send them to you. Code wise, you can see the errors when opening the tiff in your own sample application, so I do not think, sending code is necessarily required.

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

Re: Merging Wang-annotated TIFF into jpeg

Post by Alex » Wed Mar 22, 2017 2:53 pm

Hello,

The distributive package of VintaSoft Imaging .NET SDK does not have image files with WANG annotations. Please let me know the steps, which we should do for reproducing your problem.

Best regards, Alexander

mbauxd
Posts: 9
Joined: Fri Feb 26, 2016 1:27 pm

Re: Merging Wang-annotated TIFF into jpeg

Post by mbauxd » Wed Mar 22, 2017 2:56 pm

Thats what I meant by preparing some sample files for you. As soon as I have them, I'll send them to you.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest