|
I am combining 2 images on the fly and wanting to make the background of the 2nd image trasnparent. When the image is a gif the MakeTransparent Method works well but when its a jpg, it is very rough around the edges.
Any ideas will be helpful.
Jpg Example. We removed the background on the card case
<%<br />
Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("photos/3092.jpg") );<br />
Graphics graphicImage = Graphics.FromImage(bitMapImage); <br />
graphicImage.SmoothingMode = SmoothingMode.AntiAlias;<br />
graphicImage.DrawString( "LOGO HERE", new Font("Arial", 12,FontStyle.Bold ), SystemBrushes.WindowText, new Point( 40, 150 ) );<br />
Bitmap myBitmap = new System.Drawing.Bitmap(Server.MapPath("upload/3003.jpg") );<br />
Color backColor = myBitmap.GetPixel(1, 1);<br />
myBitmap.MakeTransparent(backColor);<br />
graphicImage.DrawImage(myBitmap, 0, 40, myBitmap.Width, myBitmap.Height);<br />
Response.ContentType="image/jpeg";<br />
bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);<br />
myBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);<br />
graphicImage.Dispose();<br />
bitMapImage.Dispose();<br />
myBitmap.Dispose();<br />
%>
|
|
|
|
|
I found this code in DotNetNuke:
switch (Operator)
{
case SomeEnumerator.Equal:
return Blah(parameters);
break;
...
...
}
There were three case statements in there, and all of them essentially looked like the one I showed above. The compiler was generating warnings about the break statements being unreachable code (which in fact, they are).
This is the only place this was done. Why on earth would anyone let that warning go when it's so easy to fix?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: This is the only place this was done.
You mean this was the only case statement in which it was done? or the only switch statement in which it was done?
Either way, I think they just forgot to remove it as I don't see why would anyone keep it
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
perhaps because C# is crap, and will generate errors if you don't have a break after ever case statement, so they automatically put it in, and then didn't remove it, just in case ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: because C# is crap, and will generate errors if you don't have a break after ever case statement
Actually, the return statement is fine.
"A jump statement such as a break is required after each case block, including the last block whether it is a case statement or a default statement."
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Christian Graus wrote: perhaps because C# is crap, and will generate errors if you don't have a break after ever case statement
Actually that's just fine for me, prevents a lot of people producing a lot of bugs (compared to C++ where the break is not necessary).
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Hi,
I have a window-based application having a web-browser control in it. In web browser control i access a web-based application hosted on remote server. Web-based app can only be accessed via window-based web browser control. A user needs to login in window app. To implement user rights on different pages of web app i need to pass user's id from window app to web app.
Now i want to know how to share data between window app to web app.
Any help will be appreciated.
Thanx,
Anand
|
|
|
|
|
|
Hi All,
I would like to use a control on my page to be able to play MPEG file as they are uploaded to the page.
Can you please give me any information on how to go about it?
Thanks very much.
|
|
|
|
|
|
Thank you Vasudevan,
Can you please give me the steps in encoding the Window media player in to my page?
Its not a Toolbox control.Is it not?
Regards
kibrom
|
|
|
|
|
HI
I am trying to hardcode a folder name into an image url, the below will work if i pass my value into the database, but that will cause problems later on when i need just the file name
<asp:TemplateColumn HeaderText=Products >
<asp:Image Visible=true runat=server ID=imageHolder imageurl='<%#databinder.eval(container,"dataitem.imageAddress")%>' />
</ItemTemplate>
I am wanting to convert the above like somthing below, so that it will pull the correct image from the server,(below doesn't work)
<asp:TemplateColumn HeaderText=Products >
<asp:Image Visible=true runat=server ID=imageHolder imageurl='<%#databinder.eval(container,"/imagestore/"+"dataitem.imageAddress")%>' />
</ItemTemplate>
any help appreciated
cheers
boyindie
|
|
|
|
|
try this
<asp:Image runat="server" ID="imageHolder" imageurl='<%# "/imagestore/"+ Eval("imageAddress")%>' />
Best regard
pathan
---------------------------------------------------
|
|
|
|
|
|
Thanks
plz vote if U got solution
---------------------------------------------------
|
|
|
|
|
I am building a little non-profit web app, and would like to know the nicest way to offer my 'Enter' page. I would like the message to be database based, together with a link to a terms and conditions page, and an Enter button.
The message warns that entering by clicking the Enter button implies acceptance of the terms and conditions, which are accessible through a hyperlink between the message and the button. I would like the message and the button centred on the page in both planes, and do not want to use tables for this. Which control is best for the text? Label or Literal? And, how do I centre the stuff using CSS?
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway
My New Blog
|
|
|
|
|
From MSDN:
The Literal control differs from the Label control in that the Literal control does not add any HTML elements to the text. (The Label control renders a span element.) As a consequence, the Literal control does not support any style attributes, including position attributes. However, the Literal control allows you to specify whether content is encoded.
I always use the Label to be able to use styles with it.
If you don't want to use tables, you need to use div .
To center you need to apply a style to the div . Try working with the margin attribute and use % as unit, for example:
.divStyle
{
margin: 20%;
}
This will give a margin of 20% of the available area in all 4 directions.
If you want to use different settings for top/bottom/left/right, you can use this:
margin: 10% 20% 10% 20%;
where the first is the top, the second is bottom, the third is left and the fourth is right.
You need to experiment a little with the values of the percentage to give in each direction by resizing the browser window and checking the behavior of your div .
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Thanks, that'll help me get started, but I have more than one element I want to position. I'll have to play around and see what happens.
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway
My New Blog
|
|
|
|
|
I usually place the controls (textbox, label, button) needed for the login in one table and then place the table in the div to position it on the page. I believe that positioning all the controls individually is a real mess. You end up having a div per control and then you need to manage the floating of the divs with respect to each other etc... It will eventually work but the time lost is not worth it
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Cool, thanks. I sort of suspected I couldn't easily get away from the tag that shall not be mentioned.
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway
My New Blog
|
|
|
|
|
Hi Everyone,
Is it possible to disable the specific items in a list box using javascript .Can anyone help me in this regard giving a sample.
Regards,
Manowj
|
|
|
|
|
On JavaScript, actually you can deselect on selection. However, that would be a lousy design. The better approach would be show only what is selectable.
|
|
|
|
|
Hi,
Is it possible to highlight the other items instead of disabling specific items using javascript Onchange event
Regards,
Manowj
|
|
|
|
|
You can try to make use of OPTGROUP trick, to an extent, without confusing the user too much, since OPTGROUP has a different purpose. Isn't it?
|
|
|
|
|
Dear All,
I have a custom ASP:DataGrid and want to check whether to show the image column or not by first checking the existance.
The code is here but face an strange error while rendering:
<%# if (HasImage( DataBinder.Eval(Container.DataItem, "ID").ToString() ) {%>
" width="107" height="111" alt=""> <% } %>
Please Help.
Thanks,
Sassan
|
|
|
|