473,606 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Grayscale ColorMatrix Difference

Hi I was at the search for making e.Graphics.Draw Image turn any image
to Grayscale, and I found two similar solutions but different
ColorMatrix values, what is the difference between the two? Is there
an industry standard for the GrayScale ColorMatrix values?

Thanks,
Henry

Solution #1, Jacob Grass:

http://groups.google.com.ph/groups?h...sftngp05#link3

Dim GrayShear()() As Single = New Single()() _
{New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0, 0, 0, 1, 0}, _
New Single(4) {0, 0, 0, 0, 1}}
Solution #2, Bob Powell:

http://groups.google.com.ph/groups?h....phx.gbl#link4

Dim cm As ColorMatrix = New ColorMatrix(New Single()() _
{New Single() {0.3, 0.3, 0.3, 0, 0}, _
New Single() {0.59, 0.59, 0.59, 0, 0}, _
New Single() {0.11, 0.11, 0.11, 0, 0}, _
New Single() {0, 0, 0, 1, 0}, _
New Single() {0, 0, 0, 0, 1}})
These are just portions of the code, I just copied and pasted the
Grayscale ColorMatrix values and they differ from one another.
Nov 21 '05 #1
2 3262
Use the one from Bob to get the true grayscale.

"Henry Wu" <he***********@ hotmail.com> wrote in message
news:86******** *************** **@posting.goog le.com...
Hi I was at the search for making e.Graphics.Draw Image turn any image
to Grayscale, and I found two similar solutions but different
ColorMatrix values, what is the difference between the two? Is there
an industry standard for the GrayScale ColorMatrix values?

Thanks,
Henry

Solution #1, Jacob Grass:

http://groups.google.com.ph/groups?h...sftngp05#link3

Dim GrayShear()() As Single = New Single()() _
{New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0.5, 0.5, 0.5, 0, 0}, _
New Single(4) {0, 0, 0, 1, 0}, _
New Single(4) {0, 0, 0, 0, 1}}
Solution #2, Bob Powell:

http://groups.google.com.ph/groups?h....phx.gbl#link4

Dim cm As ColorMatrix = New ColorMatrix(New Single()() _
{New Single() {0.3, 0.3, 0.3, 0, 0}, _
New Single() {0.59, 0.59, 0.59, 0, 0}, _
New Single() {0.11, 0.11, 0.11, 0, 0}, _
New Single() {0, 0, 0, 1, 0}, _
New Single() {0, 0, 0, 0, 1}})
These are just portions of the code, I just copied and pasted the
Grayscale ColorMatrix values and they differ from one another.

Nov 21 '05 #2
Thanks again Dr. ScrewUp,

I finally got the Magnifier working the way I want it.
http://wuhenry.beigetower.org/MagnifierXP-Final.zip

You remember the seperate repaint function you made, that did the
trick for it to not flicker, even when I remove the mouse monitoring
variables, it does not flicker at all. As long as I don't call any
Invalidate :)

Thanks so much,
Henry
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3980
by: tjh | last post by:
hi - i'm a bit new to PHP - i've been messing around with the GD2 image functions and was wondering: i see a lot of information about converting a color image to grayscale but i can't figure out how to determine whether an image (GIF or JPG) is grayscale in the first place. is there a way to do this in PHP?
1
7989
by: Bill Petzke | last post by:
I am of the understanding that a ColorMatrix can be used to adjust the contrast of an image. Any idea how this is done?
8
11391
by: RicercatoreSbadato | last post by:
I'm using bmp.Save() and the bmp is in PixelFormat.Format8bppIndexed. But when I open the image with Gimp, it tells me that the image is RGB and not grayscale.
0
2127
by: tlemcenvisit | last post by:
Hello I translated this code (witch convert an image to grayscale) from C#.NET to C++.NET The C#.NET code is : private void GrayScale(Bitmap b) { BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),ImageLockMode.ReadWrite,PixelFormat.Format24bppRgb); int stride = bmData.Stride;
2
3823
by: Harry Simpson | last post by:
I'm having trouble reducing the size of a bitmap programmatically: The file size of the original is 2400k. The picture is 816x1056. 16 million colors i think. I only need grayscale render. Public Sub ConvertBadBitmap(ByVal FilePath As String) Dim objPicture As New Bitmap(816, 1056, System.Drawing.Imaging.PixelFormat.Format16bppGrayScale) objPicture = objPicture.FromFile(FilePath) objPicture.Save("C:\ConvertPHOTO.bmp")
4
6896
by: Brian L. Troutwine | last post by:
I've recently begun to teach myself pygame by making a bunch of small toys. My current toy is cellular automata displayer and I've gotten a bit stuck on the displaying bit. (If automata isn't the plural of automaton please forgive me.) The current automata are only binary and are calculated using 2D Numeric arrays. It had been my assumption that once the automata was calculated I could then multiply the entire array by 255 to get a nice...
2
2522
by: Sirin Azazi | last post by:
i am trying to convert an image into grayscale format. but i have a problem saving the bmp file after the process.here the code; for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) {
8
47892
by: platinumhimani | last post by:
-How to convert any image(8,16,24,32 or 64-bit) to 8-bit grayscale -i have tried to convert a 24-bit image to grayscale using setpixel and getpixel functions, in vb.net but i am unable to save that image in grayscale format.How do i do that.It still saves in true color format. -i used picturebox1.image.save() method -i tried to convert an 8-bit image into grayscale but was unable to do it.
10
5688
by: Speed | last post by:
Hi, Could anyone tell me what is the simplest code to read a 8-bit grayscale JPEG image using C. Thanks a ton, Speed
0
7962
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8443
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8107
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8315
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6792
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5467
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3945
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1309
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.