Solved

How to make getpixel on an image, but not from a picturebox?

Posted on 2007-11-19
3
529 Views
Last Modified: 2012-05-05
We have a VB6 soft that analizes pixels, I found that GetPixel API or VB Point "create" color pixels on a PictureBox where there are only black pixels, on half the PCs our soft is installed. It´s fundamental for us to discriminate black from color pixels. We reduced the possible problems and got to the conclusion that VB PictureBox is not working properly, so we need the code to create a DC and loop through the pixels usiing API. We work with the numbers, don´t need to show the pixels.
0
Comment
Question by:cyberproject
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
danaseaman earned 500 total points
ID: 20319623
Create a DIB array from Picture and you can step through the array to analyze or modify color bits.

Using DIB Sections in VB:
http://www.vbaccelerator.com/codelib/gfx/dibsect.htm

Count Unqiue Colors Quickly:
http://www.freevbcode.com/ShowCode.asp?ID=6999
0
 

Author Comment

by:cyberproject
ID: 20336187
Thanks, this is possibly the way, the problem is my image is an EMF file, so to get the data I'am doing a PlayEnhMetaFile over a picturebox, because that API needs an hDC. The code you sent (till what I understood) needs a Loadpicture, that is a stdPicture which has no hDC.
What I need is to analize that pixels of the EMF file I have, Any ideas?
0
 

Author Comment

by:cyberproject
ID: 20343815
I found that the problem was not VB PictureBox but ClearType antialiasing over metafiles (EMF), this generates colors that surround tha black text for better readability, this color pixels appear with any method of pixel analizing. The only thing I can do right now to fix it is to disable Cleartype.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now