|
-
Feb 24th, 2002, 12:12 AM
#1
Thread Starter
Lively Member
converting to greyscale
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......
-
Feb 24th, 2002, 04:28 AM
#2
Addicted Member
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.
"1 4m 4 1337 #4xz0r!'
Janus
-
Feb 24th, 2002, 08:33 PM
#3
Thread Starter
Lively Member
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 ?
-
Feb 26th, 2002, 09:31 AM
#4
Member
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.
-
Feb 26th, 2002, 02:57 PM
#5
Addicted Member
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.
"1 4m 4 1337 #4xz0r!'
Janus
-
Feb 26th, 2002, 04:08 PM
#6
Good Ol' Platypus
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)
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 26th, 2002, 08:10 PM
#7
Addicted Member
The greyscale formula should be in that PSC submission, if it's not, I have it somewhere
"1 4m 4 1337 #4xz0r!'
Janus
-
Feb 26th, 2002, 11:05 PM
#8
Good Ol' Platypus
It was at this german VB site (VBEMPIRE) but it's down at the moment...
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|