Page 1 of 1

Image manipulation and Annotation

Posted: Fri Dec 12, 2014 1:47 pm
by tweerath
Hi I have a little problem with annotations (I'm using GDPicture10.2)
what i want to achieve is
-load image
-add annotations
-manipulate image and also annotations (rotate, crop, apply image command ie. AutoDeskew, AutoPunchHoleRemoval, AutomaticBorderRemoval etc.)
-save image and annotationXMP to file
-open image and annotations again expecting the right position and angle of annotations

I'm currently be able to manipulate image but annotations ..... (I'm having headache right now...)
Is it possible for me to accomplish this scenario without burning annotation to the image itself ?
I see that there's RotateAnnotations() (which i haven't try it yet) but with other various commands it's seems unlikely possible.
do you have any advice ?

Re: Image manipulation and Annotation

Posted: Sun Dec 14, 2014 10:58 am
by SamiKharma
Hi,

The scenario you have described is very normal and used daily. Could you please be more specific, for example, a precise set of actions that you take that do not work?

Best,
Sami

Re: Image manipulation and Annotation

Posted: Mon Dec 15, 2014 8:45 am
by tweerath
Below is the sample code i use to apply deskew command to the image

GdPictureImaging gdImaging = new GdPictureImaging();
imageId = gdImaging.CreateGdPictureImageFromFile(FilePath);
GdViewer1.DisplayFromGdPictureImage(imageId);
GdViewer1.AddRectangleAnnotInteractive(xxxxxx); before deskew.png
gdImaging.AutoDeskew(imageId);
GdViewer1.Redraw(); after deskew.png
before deskew.png
after deskew.png
As you can see in attachments the deskew command work but only with the image not annotation
What i want is to rotate the annotation together with the image while applying deskew command WITHOUT burning annotation to the image and also save the rotated annotation to xmp.

Re: Image manipulation and Annotation

Posted: Mon Dec 15, 2014 10:42 am
by SamiKharma
Hi,

This is absolutely normal. The AutoDeskew is something you apply to the image, it has nothing to do with the annotations layer.
For you to rotate the annotation the same as the deskewed angle, you should discover the angle of the skew with:
https://www.gdpicture.com/guides/gdpicture/web ... ngle).html
and then use RotateAnnotations with the same angle discovered as above, as well as the image with GdPictureImaging.RotateAngle()

I hope this helps.
Best,
Sami

Re: Image manipulation and Annotation

Posted: Mon Dec 15, 2014 11:59 am
by tweerath
Hi Sami,
Thanks for the answer but I've to say sorry since it's wasn't be much help, I've got skew angle from GetSkewAngle but the problem is RotateAnnotations() only support 90,180,270 degree rotate.
https://www.gdpicture.com/guides/gdpicture/web ... tions.html
And also getskewangle can check only in case of Autodeskew but there's others commands as RemoveHolePunch, CropBorders etc.

Re: Image manipulation and Annotation

Posted: Mon Dec 15, 2014 12:34 pm
by SamiKharma
Hi,

Ok two things:
1. For the rotation, you need to set the rotation property of each annotation, here is how:
Get the Annotation Manager of the GdViewer:
https://www.gdpicture.com/guides/gdpicture/web ... iewer.html
Get the Idx of Each Annotation by looping through the annotations to their count
For each Id, set the property Rotation by using https://www.gdpicture.com/guides/gdpicture/GdP ... Value.html

2. For the AutoCrop HolePunch etc. You have to understand that those are operations on the image. The Annotation layer has nothing to do with that. For example, it makes no sense to Holepunch an annotation.

Best,
Sami