can someone please teach me the codes that copies a picture from one picturebox and puts it in another but now in greyscale ?
and also the most efficient way cause i need the picture to appear fast.
pleaseee pleaseee give me a hand here......
Printable View
can someone please teach me the codes that copies a picture from one picturebox and puts it in another but now in greyscale ?
and also the most efficient way cause i need the picture to appear fast.
pleaseee pleaseee give me a hand here......
Here's a program I wrote for planet-source-code a long time ago, that does what you want, and more...
http://www.planet-source-code.com/vb...29762&lngWId=1
:) Let me know if it meets your needs.
ive looked at the program in the link. i looked through it but cant get mine to work.
can somebody come up with simpler codes to copy a picture from a picturebox and put it into another picturebox after converting it to greyscale ?
One method could be this.
Define an array of size (x,y) where x is the width of the picture1 and y is the height.
Read pixel by pixel from Picture1 into the array using the Pixel function. Separate it into RGB values. Average the RGB values to get the Grayscale value.
Rewrite the averaged value for each pixel into second picture box using the PSet method.
if u want email to [email protected] and I'll send u the sample code for the same.
What problem did you have getting that PSC entry to work for yours? It will be far faster than using GetPixel and SetPixel, trust me on this.
Email me at [email protected] and I can try and walk you through using get/stretchdibits.
Actually no, averaging doesn't give you the actual greyscale value, you'll find greens turn out very dull when they shouldn't.
You'll have to multiply red by 0.17, green by 0.62, and blue by 0.11 to get the actual grey. (it's something like that, I cannot remember perfectly)
The greyscale formula should be in that PSC submission, if it's not, I have it somewhere :)
It was at this german VB site (VBEMPIRE) but it's down at the moment...