picturebox getpixel
picturebox getpixel
picturebox getpixel
picturebox getpixel
picturebox getpixel
picturebox getpixel picturebox getpixel picturebox getpixel picturebox getpixel picturebox getpixel picturebox getpixel picturebox getpixel picturebox getpixel
picturebox getpixel picturebox getpixel
picturebox getpixel
Go Back  Xtreme Visual Basic Talk > > > picturebox getpixel


Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2006, 05:17 PM
cyrus_xi cyrus_xi is offline
Junior Contributor
 
Join Date: May 2004
Posts: 295
Default picturebox getpixel


How do i use getpixel and setpixel with an image loaded into a picturebox? Do i have to convert it to bmp and then set it back in the picturebox? How would i do that?
__________________
teh upload codez!!1one HAXXORD lolz
Reply With Quote
  #2  
Old 07-08-2006, 08:37 PM
Chris Ara Chris Ara is offline
Centurion
 
Join Date: Feb 2005
Posts: 176
Default

your best bet is to create a bitmap from the image like this

Code:
        Dim TempBmp As New Bitmap(PictureBox1.Image.Size.Width, PictureBox1.Image.Size.Height)
        TempBmp = PictureBox1.Image
        TempBmp.GetPixel(0, 0)
once your done manipulating the image just make the tempbmp the pictureoboxs image

Code:
     PictureBox1.Image = TempBmp
Reply With Quote
  #3  
Old 07-09-2006, 06:01 AM
jo0lspicturebox getpixel jo0ls is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Feb 2005
Location: London
Posts: 1,050
Default

If the image uses indexed color (where the actual color values are stored in the palette, and the pixels store the index of the color in the palette), then setpixel won't work. In that case you will need to convert to a non-indexed format first:
Code:
Dim TempBmp As New Bitmap(PictureBox1.Image.Size.Width, PictureBox1.Image.Size.Height) Dim g as Graphics = Graphics.FromImage(TempBmp) g.DrawImage(PictureBox1.Image, New Rectangle(0,0,TempBmp.Width, TempBmp.Height)) g.dispose TempBmp.GetPixel(0,0)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
picturebox getpixel
picturebox getpixel
picturebox getpixel picturebox getpixel
picturebox getpixel
picturebox getpixel
picturebox getpixel picturebox getpixel picturebox getpixel picturebox getpixel picturebox getpixel picturebox getpixel picturebox getpixel
picturebox getpixel
picturebox getpixel
 
picturebox getpixel
picturebox getpixel
 
-->