Scanned Image Truncation

Discussions about image processing and document imaging.
Post Reply
shauns
Posts: 21
Joined: Fri May 25, 2007 3:43 pm
Location: North West England

Scanned Image Truncation

Post by shauns » Thu May 31, 2007 12:19 pm

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

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Post by Loïc » Thu May 31, 2007 3:33 pm

Hi,

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

Regards,

Loïc

shauns
Posts: 21
Joined: Fri May 25, 2007 3:43 pm
Location: North West England

Post by shauns » Fri Jun 01, 2007 11:53 am

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

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Post by Loïc » Fri Jun 01, 2007 2:40 pm

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

shauns
Posts: 21
Joined: Fri May 25, 2007 3:43 pm
Location: North West England

Post by shauns » Fri Jun 01, 2007 3:02 pm

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

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Post by Loïc » Mon Jun 04, 2007 3:30 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest