I'm using the code show below (in VB.Net 2003) to create an image. I
want to save this image to a .PNG file such that when I subsequently
display it as part of a web page, the background of the image will be
transparent.
This test/learning code simply draws a diagonal green line across a
square box. When I display the resulting file on a web page, I want
only the line itself to be visible but what is happening is that the
entire "box" is shown (in a light grey color) with the line drawn
across it.
Any suggestions as to how I can do this?
Thanks.
-----------------------------------------------------------
Dim myPen As Pen = New Pen(Color.Green , 9))
Dim bmp As Bitmap = New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromIm age(bmp)
g.Clear(Color.P lum)
g.DrawLine(myPe n, 0, 0, 100, 100)
bmp.MakeTranspa rent(Color.Plum )
bmp.Save("TestF ile.png", System.Drawing. Imaging.ImageFo rmat.Png) 7 20228
Hi,
Try this instead.
Dim myPen As Pen = New Pen(Color.Green , 9)
Dim bmp As Bitmap = New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromIm age(bmp)
g.Clear(Color.T ransparent)
g.DrawLine(myPe n, 0, 0, 100, 100)
bmp.Save("TestF ile.png", System.Drawing. Imaging.ImageFo rmat.Png)
Ken
------------------------
"Martin" <ma**********@c omcast.net> wrote in message
news:i1******** *************** *********@4ax.c om...
I'm using the code show below (in VB.Net 2003) to create an image. I
want to save this image to a .PNG file such that when I subsequently
display it as part of a web page, the background of the image will be
transparent.
This test/learning code simply draws a diagonal green line across a
square box. When I display the resulting file on a web page, I want
only the line itself to be visible but what is happening is that the
entire "box" is shown (in a light grey color) with the line drawn
across it.
Any suggestions as to how I can do this?
Thanks.
-----------------------------------------------------------
Dim myPen As Pen = New Pen(Color.Green , 9))
Dim bmp As Bitmap = New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromIm age(bmp)
g.Clear(Color.P lum)
g.DrawLine(myPe n, 0, 0, 100, 100)
bmp.MakeTranspa rent(Color.Plum )
bmp.Save("TestF ile.png", System.Drawing. Imaging.ImageFo rmat.Png)
Thanks, Ken, but that doesn't seem to do anything different. The
resulting .PNG image still appears on the web page as a light-grey
box.
On Mon, 17 Jan 2005 11:54:03 -0500, "Ken Tucker [MVP]"
<vb***@bellsout h.net> wrote: Hi,
Try this instead.
Dim myPen As Pen = New Pen(Color.Green , 9)
Dim bmp As Bitmap = New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromIm age(bmp)
g.Clear(Color. Transparent)
g.DrawLine(myP en, 0, 0, 100, 100)
bmp.Save("Test File.png", System.Drawing. Imaging.ImageFo rmat.Png) Ken
------------------------
"Martin" <ma**********@c omcast.net> wrote in message news:i1******* *************** **********@4ax. com... I'm using the code show below (in VB.Net 2003) to create an image. I want to save this image to a .PNG file such that when I subsequently display it as part of a web page, the background of the image will be transparent.
This test/learning code simply draws a diagonal green line across a square box. When I display the resulting file on a web page, I want only the line itself to be visible but what is happening is that the entire "box" is shown (in a light grey color) with the line drawn across it.
Any suggestions as to how I can do this?
Thanks.
----------------------------------------------------------- Dim myPen As Pen = New Pen(Color.Green , 9)) Dim bmp As Bitmap = New Bitmap(100, 100) Dim g As Graphics = Graphics.FromIm age(bmp)
g.Clear(Color. Plum) g.DrawLine(myP en, 0, 0, 100, 100) bmp.MakeTransp arent(Color.Plu m) bmp.Save("Test File.png", System.Drawing. Imaging.ImageFo rmat.Png)
"Martin" <ma**********@c omcast.net> schrieb: Thanks, Ken, but that doesn't seem to do anything different. The resulting .PNG image still appears on the web page as a light-grey box.
Notice that MSIE doesn't fully support transparent PNGs! Did you try to
open the file in explorer?
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Martin wrote: Thanks, Ken, but that doesn't seem to do anything different. The resulting .PNG image still appears on the web page as a light-grey box.
Internet Explorer doesn't support transparent PNGs, as far as I
can tell from the Web. So if your testing it using IE, you won't be
seeing what you should be. On Mon, 17 Jan 2005 11:54:03 -0500, "Ken Tucker [MVP]" <vb***@bellsout h.net> wrote:
Hi,
Try this instead.
Dim myPen As Pen = New Pen(Color.Green , 9)
Dim bmp As Bitmap = New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromIm age(bmp)
g.Clear(Color .Transparent)
g.DrawLine(my Pen, 0, 0, 100, 100)
bmp.Save("Tes tFile.png", System.Drawing. Imaging.ImageFo rmat.Png) Ken
------------------------
"Martin" <ma**********@c omcast.net> wrote in message news:i1****** *************** ***********@4ax .com... I'm using the code show below (in VB.Net 2003) to create an image. I want to save this image to a .PNG file such that when I subsequently display it as part of a web page, the background of the image will be transparent .
This test/learning code simply draws a diagonal green line across a square box. When I display the resulting file on a web page, I want only the line itself to be visible but what is happening is that the entire "box" is shown (in a light grey color) with the line drawn across it.
Any suggestions as to how I can do this?
Thanks.
----------------------------------------------------------- Dim myPen As Pen = New Pen(Color.Green , 9)) Dim bmp As Bitmap = New Bitmap(100, 100) Dim g As Graphics = Graphics.FromIm age(bmp)
g.Clear(Color .Plum) g.DrawLine(my Pen, 0, 0, 100, 100) bmp.MakeTrans parent(Color.Pl um) bmp.Save("Tes tFile.png", System.Drawing. Imaging.ImageFo rmat.Png)
Yes, I am using Internet Explorer. And, I wasn't aware that it had a
problem with transparent PNGs.
This is a big problem for me. I need to display these graphics (with
transparent backgrounds) in Internet Explorer. Do you have any
suggestions as to how I might accomplish that?
How about .GIF files - do you know if they would display correctly?
Any suggestions?
A bit of background: I currently have a series of web pages (that are
used only on an Intranet) that display some simple, created-on-the-fly
images. I'm doing this now by using VML (Vector Markup Language). I
have server-side scripts that create the VML statements as part of the
web page itself. The big problem is that VML is supported ONLY in
Internet Explorer (and it's a dead technology).
I'm experimenting with using some individual images and sending them
out as part of the web pages. My thinking is that such would be
viewable in ANY browser.
On Mon, 17 Jan 2005 17:24:58 +0000, Dominic Marks
<do*@helenmarks .co.uk> wrote: Internet Explorer doesn't support transparent PNGs, as far as I can tell from the Web. So if your testing it using IE, you won't be seeing what you should be.
Well, I just tried it as a .gif file - that doesn't work either. The
image has a black background. :(
On Mon, 17 Jan 2005 10:46:43 -0700, Martin <ma**********@c omcast.net>
wrote: How about .GIF files - do you know if they would display correctly?
"Martin" <ma**********@c omcast.net> schrieb: How about .GIF files - do you know if they would display correctly?
GIF (and maybe transparent PNG8) support of MSIE is IMO better.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dan glenn |
last post by:
(PHP4.3.4, GD2) How can I save a PNG using GD2 and insure that it saves as a
palette-based (8-bit, 256-color) single-color transparancy?? Saving this
way, I could be sure that an image loaded from a transparent gif could be
saved as a png and the png would work in IE versions 5.5 and greater (IE has
bug that messes up png transparancies which use full alpha channel).
thanks for any help at all,
-dg
|
by: Dj Frenzy |
last post by:
Hi, I know how to use javascript to change a background image to
another background image, and how to change a background colour to
another background colour. Is there a way to change an image to a
backgound colour?
I have a table with a background that has a picture. When the user
hovers over the picture I want the background to change to the
background colour of the rest of the page, as if to make the picture
disappear.
|
by: Mark Tranchant |
last post by:
On my site, I use a background image of a small arrow to denote links
that lead away from my site. This page has four such links in the first
section:
http://tranchant.plus.com/notes/cable-wrap
The links are coded thus:
<a class="external" href="url">blah</a>
|
by: G .Net |
last post by:
Hi
I have a form on which I have a picture box. I have placed a GIF as the
image for this picture box. The GIF has a transparent background.
If I change the background color of the form, then the GIF appears on the
form correctly i.e. the background of the form shows through the transparent
part of the gif.
However, if I place a BackgroundImage on the form, the transparent part of
|
by: rodchar |
last post by:
hey all,
i have an image that i want to put on my form and was just wondering if
there is a way to take away the white background on the image (make it
transparent)?
thanks,
rodchar
| |
by: Dale |
last post by:
When I create a System.Drawing.Bitmap and save it as ImageType.GIF, how can I
set the transparency so that the background is transparent.
In my application, the Bitmap that I am working with has several transparent
GIFs drawn on it and the transparency of each of them works within the
bitmap, but the bitmap overall gets saved with a black background.
Any help is greatly appreciated.
|
by: Dale |
last post by:
I am creating GIF images with transparent backgrounds on-the-fly for a web
app and rendering them by using
System.Drawing.Image.Save(Response.OutputStream, ImageType.GIF).
I am confident that the transparency is working properly because if I save
the created image to the local hard disk and then view it in a web page or an
image editor, the transparency is correct. I can also view the transparency
on-the-fly in a Windows.Forms...
|
by: Angus |
last post by:
I have a web page with a toolbar containing a Save button. The Save
button can change contextually to be a Search button in some cases.
Hence the button name searchsavechanges.
The snippet of html is:
<a class="searchsavechanges btn btn3d tbbtn" href="javascript:"
style="position:static">
<div id="TBsearchsavechanges">Search</div>
</a>
|
by: stevedude |
last post by:
CSS newbie again. I have a problem trying to get coffee mug images
within anchor tags to center with my link text for a vertical list
menu. If I use the horizontal/vertical properties of "background" or
"background-image", the positioning only works with specifying
pixels.
If I specify the vertical position in pixels, the image gets cut-off
at the bottom. I don't know what to do and would appreciate anyone's
help. Specifically the code...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |