473,395 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Resize Image

Dear All

I don't know haw i resize inage in VB.NET
I want load image with size 800x600 then rezize it to 80x60 pixels and save
to a file.
--
DichkoSoft
Nov 21 '05 #1
3 2811
Private Function DrawImageCallback(callBackData As IntPtr) As Boolean
' Test for call that passes callBackData parameter.
If callBackData.Equals(IntPtr.Zero) Then
' If no callBackData passed, abort DrawImage method.
Return True
Else
' If callBackData passed, continue DrawImage method.
Return False
End If
End Function
Public Sub DrawImageRect4FloatAttribAbortData(e As PaintEventArgs)
' Create callback method.
Dim imageCallback As New _
Graphics.DrawImageAbort(AddressOf DrawImageCallback)
Dim imageCallbackData As New IntPtr(1)
' Create image.
Dim newImage As Image = Image.FromFile("SampImag.jpg")
' Create rectangle for displaying original image.
Dim destRect1 As New Rectangle(100, 25, 450, 150)
' Create coordinates of rectangle for source image.
Dim x As Single = 50F
Dim y As Single = 50F
Dim width As Single = 150F
Dim height As Single = 150F
Dim units As GraphicsUnit = GraphicsUnit.Pixel
' Draw original image to screen.
e.Graphics.DrawImage(newImage, destRect1, x, y, width, _
height, units)
' Create rectangle for adjusted image.
Dim destRect2 As New Rectangle(100, 175, 450, 150)
' Create image attributes and set large gamma.
Dim imageAttr As New ImageAttributes()
imageAttr.SetGamma(4F)
' Draw adjusted image to screen.
Try
' Draw adjusted image to screen.
e.Graphics.DrawImage(newImage, destRect2, x, y, width, _
height, units, imageAttr, imageCallback, imageCallbackData)
Catch ex As Exception
e.Graphics.DrawString(ex.ToString(), New Font("Arial", 8), _
Brushes.Black, New PointF(0, 0))
End Try
End Sub
"DichkoSoft" wrote:
Dear All

I don't know haw i resize inage in VB.NET
I want load image with size 800x600 then rezize it to 80x60 pixels and save
to a file.
--
DichkoSoft

Nov 21 '05 #2
"DichkoSoft" <di********@hotmail.com> schrieb:
I don't know haw i resize inage in VB.NET
I want load image with size 800x600 then rezize it to 80x60 pixels and
save
to a file.


Resizing an image with a certain interpolation mode
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=interpolationmode&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Dim resizedImage as Bitmap = new
Bitmap(Image.FromFile("c:\originalimage.bmp", 80, 60)
resizedImage.Save("c:\newimage.bmp")

Have fun!

Landley
"DichkoSoft" <di********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Dear All

I don't know haw i resize inage in VB.NET
I want load image with size 800x600 then rezize it to 80x60 pixels and save to a file.
--
DichkoSoft

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Z D | last post by:
Hello, BACKGROUND: ============== I've created a Windows User Control that contains an Image Control (among other controls). The user control handles the picture resize event. Whenever the...
14
by: Rudy | last post by:
Hello all! I been trying to get a handle with Images. I have learned alot from the fine people here. So, I also learned that thumbnail images look terrible taken from a digital cam. I know why...
2
by: Carl Gilbert | last post by:
Hi I am looking for either a component or technique to allow me to do the following: * Provide a panel with a background image * Resize the image to best fit the panel to maintain aspect...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
1
by: Arjen | last post by:
Hi, I want to resize an image on my server. I tried a lot of samples... but all the time it does resize and saves the images but I can not view the image insize a webbrowser. With an...
2
by: Tim Arnold | last post by:
Hi, I'm using the Image module to resize PNG images from 300 to 100dpi for use in HTML pages, but I'm losing some vertical and horizontal lines in the images (usually images of x-y plots). ...
2
by: Dominic Vella | last post by:
Hi, I know I seem to have the really complicated questions, but I guess that's why I'm here. This is a little verbose, only because I've been trying to crack this for a week now. Your help...
8
by: infoseekar | last post by:
Image Resize & Rotation Hi I have 2 scripts, one for Image rotation and other image resize and they both are working. Image resize scripts load the picture and resize it and Image rotation...
3
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi! This discussion may help other programmers get a better idea of how to save uploaded images through a website. Why? Well currently, I save 3 versions of every uploaded image on my own...
22
by: simon2x1 | last post by:
i have an image which width is 213 and height is 200 when i echo the image and i resize it echo "<img src='company/$present' width='70' height='68'/>"; the image was not as clear as when it was...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.