Click here to Skip to main content
15,887,683 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionServer unavaliable error from IIS Pin
koolprasad200316-Jun-08 23:55
professionalkoolprasad200316-Jun-08 23:55 
AnswerRe: Server unavaliable error from IIS Pin
Sam Xavier17-Jun-08 4:47
Sam Xavier17-Jun-08 4:47 
Questioncompare colors Pin
Member 343561416-Jun-08 23:47
Member 343561416-Jun-08 23:47 
AnswerRe: compare colors Pin
Imran Khan Pathan16-Jun-08 23:52
Imran Khan Pathan16-Jun-08 23:52 
GeneralRe: compare colors Pin
Member 343561417-Jun-08 0:20
Member 343561417-Jun-08 0:20 
GeneralRe: compare colors Pin
Imran Khan Pathan17-Jun-08 0:43
Imran Khan Pathan17-Jun-08 0:43 
GeneralRe: compare colors Pin
Member 343561417-Jun-08 0:55
Member 343561417-Jun-08 0:55 
GeneralRe: compare colors Pin
Imran Khan Pathan17-Jun-08 1:20
Imran Khan Pathan17-Jun-08 1:20 
See this example

I have made one method in which you can pass Bitmap object of image,current color of the image that you want to change as curColor and new color that you want to apply as newColor.

Now I am getting current color from image object using GetPixel Method of bitmap and apply new color using SetPixel Method.

this method returns bitmap object.after calling this method, call save method of bitmap so changes will apply.

Now this method will change image color that you want to change.

private Bitmap CreateGrayscale(System.Drawing.Image source, Color curColor,Color newColor)
    {

        // Create a bitmap from the image

        Bitmap bmp = new Bitmap(source);



        // Loop through each pixel in the bitmap. If we find

        // a transparent pixel, we leave it alone.

        for (int y = 0; y < bmp.Height; y++)
        {

            for (int x = 0; x < bmp.Width; x++)
            {

                // Get the color of the current pixel

                Color col = bmp.GetPixel(x, y);



                if (col.A == curColor.A && col.R==curColor.R && col.G==curColor.G && col.B==curColor.B) // No alpha (non-transparent)
                {

                    int r = (int)(newColor.R);

                    int g = (int)(newColor.G);

                    int b = (int)(newColor.B);


                    Color chgColor = Color.FromArgb(r, g, b);

                   
                    bmp.SetPixel(x, y, chgColor);

                }


            }

        }

        return bmp;
    }


regard
imrankhan

please don't forget to vote on the post that helped you.

GeneralRe: compare colors Pin
Member 343561417-Jun-08 2:15
Member 343561417-Jun-08 2:15 
Questionvirtual directory Pin
vjainpee16-Jun-08 23:35
vjainpee16-Jun-08 23:35 
AnswerRe: virtual directory Pin
N a v a n e e t h16-Jun-08 23:40
N a v a n e e t h16-Jun-08 23:40 
Questioncreate .txt Pin
vjainpee16-Jun-08 23:06
vjainpee16-Jun-08 23:06 
AnswerRe: create .txt Pin
joemonvarghese80@yahoo.co.in16-Jun-08 23:18
joemonvarghese80@yahoo.co.in16-Jun-08 23:18 
AnswerRe: create .txt Pin
N a v a n e e t h16-Jun-08 23:23
N a v a n e e t h16-Jun-08 23:23 
QuestionRoll based login Pin
vjainpee16-Jun-08 22:48
vjainpee16-Jun-08 22:48 
AnswerRe: Roll based login Pin
joemonvarghese80@yahoo.co.in16-Jun-08 23:04
joemonvarghese80@yahoo.co.in16-Jun-08 23:04 
AnswerRe: Roll based login Pin
Masood Kochi,SSF16-Jun-08 23:16
Masood Kochi,SSF16-Jun-08 23:16 
AnswerRe: Roll based login Pin
N a v a n e e t h16-Jun-08 23:28
N a v a n e e t h16-Jun-08 23:28 
GeneralRe: Roll based login Pin
Jay Royall16-Jun-08 23:59
Jay Royall16-Jun-08 23:59 
QuestionHow to Browse web application Pin
Raghvendra Kumar Roy16-Jun-08 21:51
Raghvendra Kumar Roy16-Jun-08 21:51 
AnswerRe: How to Browse web application Pin
www.Developerof.NET16-Jun-08 22:09
www.Developerof.NET16-Jun-08 22:09 
GeneralRe: How to Browse web application Pin
Raghvendra Kumar Roy16-Jun-08 22:51
Raghvendra Kumar Roy16-Jun-08 22:51 
GeneralRe: How to Browse web application Pin
www.Developerof.NET16-Jun-08 23:26
www.Developerof.NET16-Jun-08 23:26 
Questionchange image format Pin
trilokharry16-Jun-08 21:18
trilokharry16-Jun-08 21:18 
AnswerRe: change image format Pin
N a v a n e e t h16-Jun-08 21:33
N a v a n e e t h16-Jun-08 21:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.