LEADTOOLS Support
General
General Questions
How to rotate an image using AxLEADRasterView
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, April 14, 2006 9:08:49 AM(UTC)
Groups: Registered
Posts: 14
Hello,
I'm trying to rotate an image using:
Dim RasterProc As New LEADRasterProcessRasterProc.Rotate(Me.RasterView.Raster, 9000, RotateConstants.ROTATE_RESIZE, UInt32.Parse(255255255))
Me.RasterView.AutoSetRects = False
Me.RasterView.ForceRepaint()
T tried changing the RotateConstants to Rotate_Resample to prevent resizing but the image gets cut off and doesn't display correctly within the control when you rotate it again. How can I achieve this without having the image cut off and without using the resize?
#2
Posted
:
Sunday, April 16, 2006 9:02:06 PM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
Rotating without resizing will always cause cropping part of the image unless:
1. Rotation angle is a multiple of 180 degrees.
2. Or rotation angle is a multiple of 90 degrees AND the image is square (width = height).
Is your image square? Or how exactly do you want to get rotated?
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#3
Posted
:
Monday, April 17, 2006 5:00:44 AM(UTC)
Groups: Registered
Posts: 14
No, it's not square but rather rectangular with the width larger than the height and I am rotating in increments of 90 degrees. I would like it to rotate without the cropping or resizing effects if possible so that if the user rotates the image they do not have to zoom in again if the image resizes on it's own. Thanks.
#4
Posted
:
Monday, April 17, 2006 7:48:29 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
If you rotate an image by 90 degrees, you must use the Resize flag to
allow the width and height to be swapped and prevent cropping from
taking place.
For example, if the image has width=100 and height=50, rotating by 90
degrees without resizing will keep it at width=100 and height=50.
However, if you want all the original image data to stay in the rotated
image, you must allow it to resize so that the width becomes 50 and
height becomes 100. This will be lossless rotation.
Note: in the case of 90 degree rotation, no averaging or interpolation
is done regardless of which RotateConstants value you use.
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#5
Posted
:
Tuesday, April 18, 2006 6:36:22 AM(UTC)
Groups: Registered
Posts: 14
So then am I rotating per your instructions using
Dim RasterProc As New LEADRasterProcessRasterProc.Rotate(Me.RasterView.Raster, 9000, RotateConstants.ROTATE_RESIZE, UInt32.Parse(255255255))
Me.RasterView.AutoSetRects = False
Me.RasterView.ForceRepaint()
If this is what you meant by using the resize constant then it dosen't display correctly after it is rotated. It's cutting the immage off, and in some cases, cutting it into two peices with one half above the other. I'll email a screen shot if you'd like.
#6
Posted
:
Tuesday, April 18, 2006 9:57:35 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
I tried code similar to yours with LEADTOOLS 14.5 COM and one of the
images shipped with the toolkit and it worked. Here's the code I used:
Dim LeadIO2 as New LTRASTERIOLib.LEADRasterIO
LeadIO2.Load(AxLEADRasterView1.Raster, "OCR1.TIF", 0, 1, 1)
Dim RasterProc As New LTRASTERPROCLib.LEADRasterProcess
RasterProc.Rotate(Me.AxLEADRasterView1.Raster, 9000, LTRASTERPROCLib.RotateConstants.ROTATE_RESIZE, UInt32.Parse(255255255))
Me.AxLEADRasterView1.AutoSetRects = False
Me.AxLEADRasterView1.ForceRepaint()
LeadIO2.Save(AxLEADRasterView1.Raster, "rotated.tif", LTRASTERIOLib.RasterFileConstants.FILE_CCITT_GROUP4, 1, 0, 0)
I'm attaching the resulting image, which looks normal. The difference
might be caused by the image or the toolkit version. I used build
14.5.0.8 of LTRPR14n.dll. Which version do you have? Does the problem
happen when using the same image?
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
LEADTOOLS Support
General
General Questions
How to rotate an image using AxLEADRasterView
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.