Click here to Skip to main content
15,923,909 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: problems with radio buttons Pin
Dave Kreskowiak1-Oct-07 14:07
mveDave Kreskowiak1-Oct-07 14:07 
QuestionRe: problems with radio buttons Pin
zamzoum29-Sep-07 11:19
zamzoum29-Sep-07 11:19 
AnswerRe: problems with radio buttons Pin
Johan Hakkesteegt30-Sep-07 23:09
Johan Hakkesteegt30-Sep-07 23:09 
QuestionHelp extracting e-mail from outlook express Pin
ankoump28-Sep-07 10:54
ankoump28-Sep-07 10:54 
AnswerRe: Help extracting e-mail from outlook express Pin
DanB198329-Sep-07 9:26
DanB198329-Sep-07 9:26 
Questionconnection to sqlexpress through crystal reports Pin
mostafaelfeky28-Sep-07 10:25
mostafaelfeky28-Sep-07 10:25 
AnswerRe: connection to sqlexpress through crystal reports Pin
Dave Kreskowiak28-Sep-07 11:00
mveDave Kreskowiak28-Sep-07 11:00 
QuestionProblems resizing image in VB.NET Pin
Kombu28-Sep-07 10:03
Kombu28-Sep-07 10:03 
I'm reading a series of images from a MS SQL table and saving them to directory. As part of the process, I'm resizing the image and changing its resolution from 96 to 72 ppi. The resizing works without a hitch, but I cannot figure out how to reduce the resolution. All of the output files continue to be 96 ppi. Any help would be greatly appreciated.

Here's the code

<snip...>
Dim bytImage() As Byte
bytImage = .ItemArray(4)
bytImage = ChangeImageResolution(bytImage, 72)
bytImage = ResizeImage(bytImage, 150)
Dim fs As New FileStream(strFileName, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(bytImage, 0, UBound(bytImage))
fs.Close()
fs = Nothing
<snip...>
Private Function ChangeImageResolution(ByVal bytInput As Byte(), ByVal intOutputResolution As Int16) As Byte()
Dim strmInput As New System.IO.MemoryStream(bytInput)
Dim strmOutput As New System.IO.MemoryStream
Dim imgInput As System.Drawing.Image
Dim imgOutput As System.Drawing.Image
Dim bmapTemp As Bitmap

' Create a temporary bitmap and set to output resolution
imgInput = System.Drawing.Image.FromStream(strmInput)
bmapTemp = imgInput
bmapTemp.SetResolution(intOutputResolution, intOutputResolution)
imgOutput = New Bitmap(bmapTemp)
imgOutput.Save(strmOutput, System.Drawing.Imaging.ImageFormat.Jpeg)

' Return the output image in a byte array
ChangeImageResolution = strmOutput.ToArray
End Function
Private Function ResizeImage(ByVal bytInput As Byte(), ByVal intFinalMaxDim As Int16) As Byte()
Dim strmInput As New System.IO.MemoryStream(bytInput)
Dim strmOutput As New System.IO.MemoryStream
Dim imgInput As System.Drawing.Image
Dim imgOutput As System.Drawing.Image
Dim intMaxDim As Int16 = 0
Dim intResizePercentage As Double = 0
Dim sizResize As New Size

' Determine the resizing percentage based on current image dimensions
imgInput = System.Drawing.Image.FromStream(strmInput)
If imgInput.Height >= imgInput.Width Then
intMaxDim = imgInput.Height
Else
intMaxDim = imgInput.Width
End If
intResizePercentage = (intFinalMaxDim / intMaxDim)
With sizResize
.Width = CInt(imgInput.Width * intResizePercentage)
.Height = CInt(imgInput.Height * intResizePercentage)
End With

' Create a new resized version of the image
imgOutput = New Bitmap(imgInput, sizResize.Width, sizResize.Height)
imgOutput.Save(strmOutput, System.Drawing.Imaging.ImageFormat.Jpeg)

' Return the output image in a byte array
ResizeImage = strmOutput.ToArray
End Function

AnswerRe: Problems resizing image in VB.NET Pin
Dave Kreskowiak28-Sep-07 10:59
mveDave Kreskowiak28-Sep-07 10:59 
GeneralRe: Problems resizing image in VB.NET Pin
Kombu28-Sep-07 12:35
Kombu28-Sep-07 12:35 
QuestionSimulating a mouseclick Pin
The real $M@28-Sep-07 8:31
The real $M@28-Sep-07 8:31 
AnswerRe: Simulating a mouseclick Pin
Dave Kreskowiak28-Sep-07 9:36
mveDave Kreskowiak28-Sep-07 9:36 
QuestionWizard Creation Pin
zoljin28-Sep-07 5:49
zoljin28-Sep-07 5:49 
AnswerRe: Wizard Creation Pin
Dave Kreskowiak28-Sep-07 6:20
mveDave Kreskowiak28-Sep-07 6:20 
QuestionVisual Studio error opening form file, help tracing location Pin
svanwass28-Sep-07 5:35
svanwass28-Sep-07 5:35 
AnswerRe: Visual Studio error opening form file, help tracing location Pin
Dave Kreskowiak28-Sep-07 6:17
mveDave Kreskowiak28-Sep-07 6:17 
GeneralRe: Visual Studio error opening form file, help tracing location Pin
svanwass28-Sep-07 7:18
svanwass28-Sep-07 7:18 
QuestionShowing webpages Pin
The real $M@28-Sep-07 5:14
The real $M@28-Sep-07 5:14 
AnswerRe: Showing webpages Pin
svanwass28-Sep-07 5:38
svanwass28-Sep-07 5:38 
GeneralRe: Showing webpages Pin
The real $M@28-Sep-07 20:38
The real $M@28-Sep-07 20:38 
AnswerRe: Showing webpages Pin
DigiOz Multimedia28-Sep-07 8:47
DigiOz Multimedia28-Sep-07 8:47 
GeneralRe: Showing webpages Pin
Dave Kreskowiak28-Sep-07 9:21
mveDave Kreskowiak28-Sep-07 9:21 
GeneralRe: Showing webpages Pin
DigiOz Multimedia28-Sep-07 19:20
DigiOz Multimedia28-Sep-07 19:20 
QuestionAccessing controls on startup Form Pin
AliAmjad28-Sep-07 4:21
AliAmjad28-Sep-07 4:21 
AnswerRe: Accessing controls on startup Form Pin
Dave Kreskowiak28-Sep-07 6:10
mveDave Kreskowiak28-Sep-07 6:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.