[code=vbnet]
Private Sub SaveResized()
Dim bm As New Bitmap(PictureB ox1.Image)
Dim myX As Integer
Dim myY As Integer
myX = 640
myY = 480
If myY = 0 Or myX = 0 Then Exit Sub Else
Dim thumb As New Bitmap(myX, myY)
Dim g As Graphics = Graphics.FromIm age(thumb)
g.Interpolation Mode = Drawing2D.Inter polationMode.Hi ghQualityBicubi c
g.DrawImage(bm, New Rectangle(0, 0, myX, myY), New Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pi xel)
g.Dispose()
Dim message, title, defaultValue As String
'Dim myValue As String
'message = "Enter File Name:" ' Set prompt.
'title = "Save Resized Photo" ' Set title.
defaultValue = "" ' Set default value.
'get name to save resized image, using Inputbox
'myValue = InputBox(messag e, title, defaultValue)
'If myValue = "" Then bm.Dispose() : thumb.Dispose() : Exit Sub Else
thumb.Save("C:\ temp\Boot.bmp", System.Drawing. Imaging.ImageFo rmat.Bmp)
bm.Dispose()
thumb.Dispose()
'Dim caption As String = "Save Resized Photo"
'MessageBox.Sho w("The Resized Photo has been saved as: " & i, caption, MessageBoxButto ns.OK, MessageBoxIcon. Exclamation)
End Sub
[/code]
The code above formats the image in my picturebox and saves it accordingly.
Problem - The image bit depth is 32
i want it to be 16
can any1 help?
James
Private Sub SaveResized()
Dim bm As New Bitmap(PictureB ox1.Image)
Dim myX As Integer
Dim myY As Integer
myX = 640
myY = 480
If myY = 0 Or myX = 0 Then Exit Sub Else
Dim thumb As New Bitmap(myX, myY)
Dim g As Graphics = Graphics.FromIm age(thumb)
g.Interpolation Mode = Drawing2D.Inter polationMode.Hi ghQualityBicubi c
g.DrawImage(bm, New Rectangle(0, 0, myX, myY), New Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pi xel)
g.Dispose()
Dim message, title, defaultValue As String
'Dim myValue As String
'message = "Enter File Name:" ' Set prompt.
'title = "Save Resized Photo" ' Set title.
defaultValue = "" ' Set default value.
'get name to save resized image, using Inputbox
'myValue = InputBox(messag e, title, defaultValue)
'If myValue = "" Then bm.Dispose() : thumb.Dispose() : Exit Sub Else
thumb.Save("C:\ temp\Boot.bmp", System.Drawing. Imaging.ImageFo rmat.Bmp)
bm.Dispose()
thumb.Dispose()
'Dim caption As String = "Save Resized Photo"
'MessageBox.Sho w("The Resized Photo has been saved as: " & i, caption, MessageBoxButto ns.OK, MessageBoxIcon. Exclamation)
End Sub
[/code]
The code above formats the image in my picturebox and saves it accordingly.
Problem - The image bit depth is 32
i want it to be 16
can any1 help?
James
Comment