Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, April 14, 2006 9:13:49 AM(UTC)
caddsman

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?

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, April 16, 2006 9:07:06 PM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


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
 
#3 Posted : Monday, April 17, 2006 5:05:44 AM(UTC)
caddsman

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:53:29 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


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
 
#5 Posted : Tuesday, April 18, 2006 6:41:22 AM(UTC)
caddsman

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 10:02:35 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


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?

File Attachment(s):
rotated.zip (72kb) downloaded 32 time(s).
Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
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.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.233 seconds.