Resizing an image
Started by hennicken at 01-15-2007 5:26. Topic has 10 replies.
|
|
01-15-2007, 5:26
|
hennicken
Joined on 05-11-2006
Posts 12
|
|
|
Hi.
I'm looking for the easiest way to "shrink" a scanned picture. I need a 10% smaller duplicate of my previous scanned picture, but it's got to have the same size. I need a border arround my picture, that's why I have to shrink it.
|
|
|
|
|
Report
|
|
|
|
01-15-2007, 8:46
|
Maen Hasan

Joined on 08-05-2004
Posts 1,795
|
|
|
Hello,
What is the exact LEADTOOLS version that you use? And what is the programming interface that you use?
Thanks, Maen Badwan LEADTOOLS Technical Support
|
|
|
|
|
Report
|
|
|
|
01-15-2007, 11:16
|
hennicken
Joined on 05-11-2006
Posts 12
|
|
|
Leadtools 11.5 with VB.NET 2003
|
|
|
|
|
Report
|
|
|
|
01-17-2007, 2:03
|
Maen Hasan

Joined on 08-05-2004
Posts 1,795
|
|
|
Hello,
You can use the Size method (Main Control) to resize the bitmap to a new width and height. For more information, please refer to the LEADTOOLS documentation and read the related topic.
Thanks, Maen Badwan LEADTOOLS Technical Support
|
|
|
|
|
Report
|
|
|
|
01-17-2007, 9:20
|
hennicken
Joined on 05-11-2006
Posts 12
|
|
|
i try to show you exactly, what i need. i want to make a new picture, whch has got the same resolution, like the original. but shows a smaller duplicate of the original centered in it. VB.NET2003 activex leadtools 11.5
is there a way to realize this?
thanks stefan
|
|
|
|
|
Report
|
|
|
|
01-18-2007, 11:27
|
Maen Hasan

Joined on 08-05-2004
Posts 1,795
|
|
|
Hello,
Actually, the Size method is one step. The full steps are: 1. Use a second control and create a blank image with the same size and pixel depth as the original using CreateBitmap method. 2. Fill the new image with the border color you want using the Fill method 3. Resize (shrink) the original image using the Size method 4. Copy the pixel data from the 'shrunk' image to the new image using the Combine method.
Thanks, Maen Badwan LEADTOOLS Technical Support
|
|
|
|
|
Report
|
|
|
|
01-31-2007, 11:03
|
hennicken
Joined on 05-11-2006
Posts 12
|
|
|
Hello again,
the solution works well, but now i've got another problem. i can't see the whole picture. i need a smaller copy of my picture, but i get only a section of my picture as i try to show you in my picture.
Could you please help me again?!?!
|
|
|
|
|
Report
|
|
|
|
01-31-2007, 14:29
|
GregR

Joined on 05-31-2006
In House
Posts 1,705
|
|
|
Make sure you are completing Maen's step 3 properly before combining as in Step 4. The image you combined onto the black background is the same size and it looks like you only cropped the image rather than shrinking it with using the Size method.
Greg Ross LEADTOOLS Technical Support
|
|
|
|
|
Report
|
|
|
|
02-01-2007, 3:38
|
hennicken
Joined on 05-11-2006
Posts 12
|
|
|
I think i did it right, but thats's my code AxLEAD1.Load("c:\test.tif", 1, 1, 1) AxLEAD2.CreateBitmap(AxLEAD1.InfoWidth, AxLEAD1.InfoHeight, 1) Dim leadsize As System.Drawing.Size leadsize = New System.Drawing.Size(AxLEAD1.InfoWidth * 0.94, AxLEAD1.InfoHeight * 0.94) AxLEAD1.Size = leadsize AxLEAD2.BitmapHeight = AxLEAD1.InfoHeight * 0.94 AxLEAD2.Size = leadsize AxLEAD2.Fill(System.UInt32.Parse("FFFFFF", Globalization.NumberStyles.HexNumber)) AxLEAD2.Combine(AxLEAD2.Width * 0.03, AxLEAD2.Height * 0.03, AxLEAD2.Width * 0.94, AxLEAD2.Height * 0.94, AxLEAD1.Bitmap, 0, 0, 801) AxLEAD2.ForceRepaint() AxLEAD2.AutoRepaint = True AxLEAD1.Visible = False AxLEAD2.Top = 0 AxLEAD2.Left = 0 AxLEAD2.Width = 200 AxLEAD2.Height = 200 AxLEAD2.Flip() AxLEAD2.Save("c:\test2.tif", 29, 1, 0, 0) Could you please check, if there's a mistake in my code?
Thanks Stefan
|
|
|
|
|
Report
|
|
|
|
02-01-2007, 5:04
|
Maen Hasan

Joined on 08-05-2004
Posts 1,795
|
|
|
Hello,
Please try to use the following code: +-----------------------------------+ AxLEAD1.PaintSizeMode = LEADLib.PaintSizeModeConstants.PAINTSIZEMODE_FIT AxLEAD2.PaintSizeMode = LEADLib.PaintSizeModeConstants.PAINTSIZEMODE_FIT AxLEAD1.Load("c:\fax1.tif", 1, 1, 1) AxLEAD2.CreateBitmap(AxLEAD1.InfoWidth, AxLEAD1.InfoHeight, 1) AxLEAD1.CtlSize(AxLEAD1.BitmapWidth * 0.94, AxLEAD1.BitmapHeight * 0.94, 0) AxLEAD2.Fill(System.UInt32.Parse("FFFFFF", Globalization.NumberStyles.HexNumber)) AxLEAD1.Combine((AxLEAD2.BitmapWidth - AxLEAD1.BitmapWidth) / 2, (AxLEAD2.BitmapHeight - AxLEAD1.BitmapHeight) / 2, AxLEAD1.BitmapWidth, AxLEAD1.BitmapHeight, AxLEAD1.Bitmap, 0, 0, LEADLib.CombineConstants.CB_OP_ADD And LEADLib.CombineConstants.CB_DST_0) AxLEAD2.ForceRepaint() AxLEAD2.AutoRepaint = True AxLEAD1.Visible = True +-----------------------------------+
Thanks, Maen Badwan LEADTOOLS Technical Support
|
|
|
|
|
Report
|
|
|
|
02-01-2007, 9:28
|
hennicken
Joined on 05-11-2006
Posts 12
|
|
|
Hi,
i've found a mistake in your code It must be AxLead2.combine(.......), but after changing this, it worked great.
Thanks a lot!
Stefan
|
|
|
|
|
Report
|
|
|
|
|
LEAD Support Fo... » Developer » Common Dialogs » Resizing an image
|
|
Copyright LEAD Technologies, Inc. 2008
