473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Making an uploaded bitmap transparent and then showing it

Jax
So far i've not had much luck with this method.
Bitmap.MakeTransparent(someColor);
Makes the transparent colour either a non-transparent black (.bmp, jpg or .gif) or silver (.png) i've tried another solution with system.drawing making the selected color have a zero alpha setting (in the palette) but when the image is re-uploaded (saved as .gif) it shows no transparency.
Does anyone else have any experience in doing this in ASP.NET, if so what are the best solutions?
Any help would be muchly appreciated.

jax

Nov 18 '05 #1
2 2197
You may define an object

Dim objbitmap As Bitmap

Then assign your image to objbitmap after working on it

Then you can save it as

objbitmap.Save(Response.OutputStream, ImageFormat.Gif)

In the below example you will see
ObjGraphics = Graphics.FromImage(objbitmap)

This could be the key
-------------------------------------------------------------------

Here i give you an example but this is related to on-the-fly with GDI+

<%@ Page ContentType="image/gif" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>

<Script Runat="Server">

Sub Page_Load
Dim objBitmap As Bitmap
Dim objGraphics As Graphics
Dim objBrush, objBrush2 As Brush

' Create Bitmap
objBitmap = New Bitmap( 400, 400 )
objGraphics = Graphics.FromImage( objBitmap )

' Create Different Colored Brushes
objBrush = New SolidBrush( Color.Blue )
objBrush2 = New SolidBrush( Color.FromArgb( 100, Color.Orange ) )

' Create Rectangles
objGraphics.FillRectangle( objBrush, 10, 10, 100, 100 )
objGraphics.FillRectangle( objBrush2, 50, 50, 100, 100 )

' Display the Bitmap
objBitmap.Save( Response.OutputStream, ImageFormat.Gif )
End Sub

</Script>
--------------------------------------------------------------Creates a
bitmap image with two rectangles overlapping one on anotherupper one is
painted with an orange brush that has an alpha value of 100

"Jax" <an*******@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
So far i've not had much luck with this method.
Bitmap.MakeTransparent(someColor);
Makes the transparent colour either a non-transparent black (.bmp, jpg or ..gif) or silver (.png) i've tried another solution with system.drawing
making the selected color have a zero alpha setting (in the palette) but
when the image is re-uploaded (saved as .gif) it shows no transparency. Does anyone else have any experience in doing this in ASP.NET, if so what are the best solutions? Any help would be muchly appreciated.

jax

Nov 18 '05 #2
here is another solution you can use style on the userside HTML

style="filter:alpha(opacity=50);">

for Iframe or any object

"Jax" <an*******@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
So far i've not had much luck with this method.
Bitmap.MakeTransparent(someColor);
Makes the transparent colour either a non-transparent black (.bmp, jpg or ..gif) or silver (.png) i've tried another solution with system.drawing
making the selected color have a zero alpha setting (in the palette) but
when the image is re-uploaded (saved as .gif) it shows no transparency. Does anyone else have any experience in doing this in ASP.NET, if so what are the best solutions? Any help would be muchly appreciated.

jax

Nov 18 '05 #3

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

Similar topics

0
by: James Dean | last post by:
I am drawing to an offscreen bitmap various shapes and so on. I have created a bitmap for this purpose. But the bitmap has a black background so i used the make transparent method to clear the...
7
by: Peter Oliphant | last post by:
Using MakeTransparent one can supposedly turn a color used in a Bitmap to transparent. But, it looks to me like all it does it set these pixels to the color BackColor of the Control it's attached...
2
by: Brad | last post by:
I have code which takes an image, uploaded from a web page, and saves it to a database. Now I want to always resize an uploaded image before it is saved to the database. My code to resize is...
6
by: Lespaul36 | last post by:
From what I have read, there isn't really a converter to icon format..it becomes a png file. I tried: 1: Dim bmp As Bitmap = CType(Bitmap.FromFile("C:\myfolder\file.bmp"), Bitmap) 2: ...
2
by: Carl Gilbert | last post by:
Hi I have to following code which sets up a new bitmap. 'set up a transparent 16x16 bitmap Dim bm As New Bitmap(16, 16) Dim g As Graphics = Graphics.FromImage(bm)...
3
by: Dennis | last post by:
I have a bitmap and make the color transparent; mybitmap.MakeTransparent(Color.Black) When I save it as a Icon, the black color is not transparent. However, if I save it as a bitmap then...
1
by: Ricardo Furtado | last post by:
in my app i must have several pictureboxes over the others. Some pictureboxes just have a couple of lines or rectangles, and absolutly nothing more but the image is an .BMP. So, my problem is that...
2
by: Dennis | last post by:
I have about 50 images in my application as "embedded resources". They are Icon size (16x16 and 24x24 and 32x32). I can use either the bitmap version or convert them to Icons. Either way seems...
5
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.