Making an uploaded bitmap transparent and then showing it

G

Guest

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
 
I

Ismail Rajput

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 said:
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.
 
I

Ismail Rajput

here is another solution you can use style on the userside HTML

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

for Iframe or any object

Jax said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top