Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2007-11-19
3
536 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

829 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