473,387 Members | 1,493 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,387 software developers and data experts.

Save image - bit depth?

jamesd0142
469 256MB
Expand|Select|Wrap|Line Numbers
  1. Private Sub SaveResized()
  2.  
  3.         Dim bm As New Bitmap(PictureBox1.Image)
  4.  
  5.         Dim myX As Integer
  6.  
  7.         Dim myY As Integer
  8.  
  9.         myX = 640
  10.  
  11.         myY = 480
  12.  
  13.         If myY = 0 Or myX = 0 Then Exit Sub Else 
  14.  
  15.         Dim thumb As New Bitmap(myX, myY)
  16.  
  17.         Dim g As Graphics = Graphics.FromImage(thumb)
  18.  
  19.         g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
  20.  
  21.         g.DrawImage(bm, New Rectangle(0, 0, myX, myY), New Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pixel)
  22.  
  23.         g.Dispose()
  24.  
  25.         Dim message, title, defaultValue As String
  26.  
  27.         'Dim myValue As String
  28.  
  29.         'message = "Enter File Name:" ' Set prompt.
  30.  
  31.         'title = "Save Resized Photo" ' Set title.
  32.  
  33.         defaultValue = "" ' Set default value.
  34.  
  35.         'get name to save resized image, using Inputbox
  36.  
  37.         'myValue = InputBox(message, title, defaultValue)
  38.  
  39.         'If myValue = "" Then bm.Dispose() : thumb.Dispose() : Exit Sub Else 
  40.  
  41.         thumb.Save("C:\temp\Boot.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
  42.  
  43.         bm.Dispose()
  44.  
  45.         thumb.Dispose()
  46.  
  47.         'Dim caption As String = "Save Resized Photo"
  48.  
  49.         'MessageBox.Show("The Resized Photo has been saved as: " & i, caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
  50.  
  51.     End Sub
  52.  
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
May 29 '08 #1
2 5728
Plater
7,872 Expert 4TB
Have you tried adding in somewhere the following line:
Expand|Select|Wrap|Line Numbers
  1. thumb.PixelFormat = PixelFormat.Format16bppRgb555
  2.  
You may want to check under the PixelFormat to see if there is on you like better.
May 29 '08 #2
jamesd0142
469 256MB
fixed it thanks...

changed line 15 above to:

Expand|Select|Wrap|Line Numbers
  1. Dim thumb As New Bitmap(myX, myY, Imaging.PixelFormat.Format16bppRgb555) '----
  2.  
May 30 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
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....
3
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...
9
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...
1
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...
1
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...
1
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
2
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
7
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,...
2
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 =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
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...

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.