-
Private Sub SaveResized()
-
-
Dim bm As New Bitmap(PictureBox1.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.FromImage(thumb)
-
-
g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
-
-
g.DrawImage(bm, New Rectangle(0, 0, myX, myY), New Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pixel)
-
-
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(message, title, defaultValue)
-
-
'If myValue = "" Then bm.Dispose() : thumb.Dispose() : Exit Sub Else
-
-
thumb.Save("C:\temp\Boot.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
-
-
bm.Dispose()
-
-
thumb.Dispose()
-
-
'Dim caption As String = "Save Resized Photo"
-
-
'MessageBox.Show("The Resized Photo has been saved as: " & i, caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
-
-
End Sub
-
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
2 5728
Have you tried adding in somewhere the following line: -
thumb.PixelFormat = PixelFormat.Format16bppRgb555
-
You may want to check under the PixelFormat to see if there is on you like better.
fixed it thanks...
changed line 15 above to: -
Dim thumb As New Bitmap(myX, myY, Imaging.PixelFormat.Format16bppRgb555) '----
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Laszlo Zsolt Nagy |
last post by:
I would like to load image from a directory right into an image list.
I wrote a simple library that loads the images in the directory and
resizes them as needed before adding to the wx.ImageList....
|
by: tlviewer |
last post by:
hello,
The script below is a prototype for loading playing card images
from the bitmap resource in cards.dll (WinXP)
I like the idea of not keeping copies of the images
as files.
I'm able...
|
by: Mark Johnson |
last post by:
How can you save all or a portion of the Grafics object to a Image/Bitmap ?
I am try to save the Images from Cards.dll to a BitMap file.
I can read in the Images to the Grafics, but when I try this...
|
by: Shawn |
last post by:
Hi. I haven't been able to get an answer in the vb newsgroup on the topic,
so I'll try here. I'm converting .tif images into other image formats like
..jpeg and .gif and I need to know how I can...
|
by: Hardy Wang |
last post by:
Hi,
I found a piece of code to add drop shadow to a photo like below, after
I save the image, it is actually a BMP file even though I specify a JPG file
extension (see...
|
by: Onwuka Emeka |
last post by:
is there a way to reduce or modify the color depth of a jpeg image, i
currently need to programatically change the color depth of a jpeg image
from 24bits to 8bits. any help would be appreciated
|
by: Onwuka Emeka |
last post by:
is there a way to reduce or modify the color depth of a jpeg image, i
currently need to programatically change the color depth of a jpeg image
from 24bits to 8bits. any help would be appreciated
|
by: Mads Aggerholm |
last post by:
Hello Sirs,
I am having a BMP loadet into a picturebox. This I'd like to save on
my harddisk as a GIF:
picturebox1.Image.Save("C:\\DATA\\PICTURES\\testpic.gif",
ImageFormat.Gif);
However,...
|
by: cleary1981 |
last post by:
Hi, I have created a script in PHP thats generates an SVG image. Want I want to do is have PHP save this as example.svg. Can this be done? Heres my code
<?php
require "config.php";
$proj_id =...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
| |