Click here to Skip to main content
15,914,111 members
Home / Discussions / C#
   

C#

 
AnswerRe: Extract data from image Pin
vaghelabhavesh26-Jan-09 16:42
vaghelabhavesh26-Jan-09 16:42 
GeneralRe: Extract data from image Pin
Member 314727926-Jan-09 18:14
Member 314727926-Jan-09 18:14 
GeneralRe: Extract data from image Pin
benjymous26-Jan-09 23:36
benjymous26-Jan-09 23:36 
QuestionChange background color of an image Pin
Xmen Real 26-Jan-09 13:52
professional Xmen Real 26-Jan-09 13:52 
AnswerRe: Change background color of an image Pin
Guffa26-Jan-09 14:03
Guffa26-Jan-09 14:03 
GeneralRe: Change background color of an image Pin
Xmen Real 26-Jan-09 14:52
professional Xmen Real 26-Jan-09 14:52 
GeneralRe: Change background color of an image Pin
Guffa26-Jan-09 19:39
Guffa26-Jan-09 19:39 
GeneralRe: Change background color of an image [modified] Pin
Xmen Real 26-Jan-09 22:09
professional Xmen Real 26-Jan-09 22:09 
No, you misunderstood, here is some example Smile | :)

Transparent Image
Added Red Back Color

now see the last image, i added color red but i just want color back to the image, not in entire image


i can do something nearly, Fill a rectangle with Red color, draw image then use MakeTransparent(Color.Red) but it wont do exactly what i want, it will not set alpha. My image wont be transparent anymore.

the otherway i can use is : (just wrote directly, not tested)

Bitmap bmp = new Bitmap(ofd.FileName);
Bitmap bmp_backColor = new Bitmap(bmp.Width, bmp.Height);
for (int x = 0; x < bmp.Width; x++)
{
    for (int y = 0; y < bmp.Height; y++)
    {
        Color tmp_oldColor = bmp.GetPixel(x, y);
        if (tmp_oldColor != Color.Transparent)
        {
            Color tmp_newColor = Color.FromArgb(tmp_oldColor.A, 255, 0, 0);
            bmp_backColor.SetPixel(x, y, tmp_newColor);
        }
    }
}
Graphics m_gr = Graphics.FromImage(bmp_backColor);
m_gr.DrawImage(bmp, 0, 0, bmp.Width, bmp.Height);
m_gr.Dispose();

pictureBox1.BackgroundImage = bmp_backColor;


Is this way right ?



Modified :

I updated the code with working one,
The Working Output

My question, is that the only way or is that way good ?

TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can

modified on Tuesday, January 27, 2009 4:21 AM

AnswerRe: Change background color of an image Pin
PandemoniumPasha26-Jan-09 19:33
PandemoniumPasha26-Jan-09 19:33 
GeneralRe: Change background color of an image Pin
Xmen Real 26-Jan-09 21:57
professional Xmen Real 26-Jan-09 21:57 
QuestionDataRows with no primary key, and listbox items Pin
Lodeclaw26-Jan-09 13:27
Lodeclaw26-Jan-09 13:27 
AnswerRe: DataRows with no primary key, and listbox items Pin
Wendelius27-Jan-09 3:34
mentorWendelius27-Jan-09 3:34 
Questionswitch on computer Pin
eMOx26-Jan-09 11:11
eMOx26-Jan-09 11:11 
AnswerRe: switch on computer Pin
User 665826-Jan-09 11:13
User 665826-Jan-09 11:13 
AnswerRe: switch on computer Pin
Thomas Stockwell26-Jan-09 11:18
professionalThomas Stockwell26-Jan-09 11:18 
GeneralRe: switch on computer Pin
Garth J Lancaster26-Jan-09 11:25
professionalGarth J Lancaster26-Jan-09 11:25 
AnswerRe: switch on computer Pin
Garth J Lancaster26-Jan-09 11:22
professionalGarth J Lancaster26-Jan-09 11:22 
GeneralRe: switch on computer Pin
Mark Churchill26-Jan-09 12:57
Mark Churchill26-Jan-09 12:57 
AnswerRe: switch on computer Pin
Drew Stainton26-Jan-09 15:42
Drew Stainton26-Jan-09 15:42 
GeneralRe: switch on computer Pin
PIEBALDconsult26-Jan-09 18:06
mvePIEBALDconsult26-Jan-09 18:06 
GeneralRe: switch on computer Pin
Drew Stainton26-Jan-09 18:14
Drew Stainton26-Jan-09 18:14 
QuestionC# and SQL Part 2: Attack of the "Login Failed For (thiscomputer)/Guest"! Pin
Michael Fritzius26-Jan-09 10:57
professionalMichael Fritzius26-Jan-09 10:57 
AnswerRe: C# and SQL Part 2: Attack of the "Login Failed For (thiscomputer)/Guest"! [modified] Pin
Wendelius26-Jan-09 11:16
mentorWendelius26-Jan-09 11:16 
GeneralRe: C# and SQL Part 2: Attack of the "Login Failed For (thiscomputer)/Guest"! Pin
Michael Fritzius26-Jan-09 12:29
professionalMichael Fritzius26-Jan-09 12:29 
GeneralRe: C# and SQL Part 2: Attack of the "Login Failed For (thiscomputer)/Guest"! Pin
Wendelius26-Jan-09 18:24
mentorWendelius26-Jan-09 18:24 

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.