Page 1 of 1

Scanned Image Truncation

Posted: Thu May 31, 2007 12:19 pm
by shauns
When I scan an A4 page and apply a rotation of 90 degrees to it in gdPicture Pro, the top and bottom of the document (that are now the sides) are cut off. It is like the original width of the document is used to clip it when displayed in gdViewer. Rotating through a further 90 degrees does not make the document whole again

I am using VS2003 C#. The gdViwer uses the same values as that in your VB6 sample RotateByAngle. That sample does not cause this problem

Posted: Thu May 31, 2007 3:33 pm
by Loïc
Hi,

Could you post the code you are using to do that ?

Regards,

Loïc

Posted: Fri Jun 01, 2007 11:53 am
by shauns
Hi

This is the code I am using in the prototype. I am using setzoomfit

private bool RotateImage(int angle, int page)
{
int _imageSource = 0;
GdpicturePro.cGdPictureStatus _status;

_imageProcessor.SetNativeImage((int)_documentPage[page]);
_imageToRotate = (int)_documentPage[page];
_status = _imageProcessor.ConvertTo16Bpp();
_imageSource = _imageProcessor.GetNativeImage();
_imageProcessor.CloseImage(_imageToRotate);

_status = _imageProcessor.RotateAnglePreserveDimentionsCenter(angle);
_imageToRotate = _imageProcessor.GetNativeImage();
_imageProcessor.CloseImage(_imageSource);

_status = _imageProcessor.ConvertTo1BppFast();
_imageSource = _imageProcessor.GetNativeImage();
_imageProcessor.CloseImage(_imageToRotate);

_documentPage[page] = _imageSource;
imgViewer.DisplayFromImageRef(_imageSource);
return true;
}

regards

Shaun

Posted: Fri Jun 01, 2007 2:40 pm
by Loïc
Hi,

For your need you can replace this line of code

Code: Select all

 _status = _imageProcessor.RotateAnglePreserveDimentionsCenter(angle); 

by this one:

Code: Select all

 _status = _imageProcessor.RotateAngle(angle); 

The best way to make a 90° rotation is tu use the Rotate() method:

https://www.gdpicture.com/references/gdp ... otate.html


Best regards,

Loïc Carrère

Posted: Fri Jun 01, 2007 3:02 pm
by shauns
Hi,

When I tried that, the image size got smaller every time that I clicked on Rotate.

When I used the Rotate method I got a run time exception

regards

Shaun

Posted: Mon Jun 04, 2007 3:30 pm
by Loïc
Hi,
When I tried that, the image size got smaller every time that I clicked on Rotate.
It is normal: When you are doing a rotation by angle the image must be enlarge to contains the full old image data...

One tip: make a clone of the original image each time you want to apply an angle rotation.

ex:

Code: Select all

nOriginalImage = oGdPicture.GetNativeImage()
nRotatedImage = oGdPicture.CreateClonedImage(nOriginalImage)
oGdPicture.SetNativeImage (nRotatedImage)
nStat = oGdPicture.RotateAngler(nAngle)



When I used the Rotate method I got a run time exception


The last pre-release have this bug fixed. https://www.gdpicture.com/ressources/betas/


Best regards,

Loïc