Making an uploaded bitmap transparent and then showing it

Discussion in 'ASP .Net' started by =?Utf-8?B?SmF4?=, Feb 21, 2004.

  1. 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
     
    =?Utf-8?B?SmF4?=, Feb 21, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
    >
     
    Ismail Rajput, Feb 21, 2004
    #2
    1. Advertising

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

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

    for Iframe or any object

    "Jax" <> wrote in message
    news:...
    > 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
    >
     
    Ismail Rajput, Feb 21, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt G
    Replies:
    1
    Views:
    1,198
    Deepak Kumar Vasudevan
    Aug 22, 2003
  2. Gandalf

    Masked bitmap from bitmap

    Gandalf, Jan 29, 2004, in forum: Python
    Replies:
    0
    Views:
    617
    Gandalf
    Jan 29, 2004
  3. Replies:
    1
    Views:
    363
    Noah Roberts
    Jul 24, 2006
  4. xqggz
    Replies:
    1
    Views:
    456
    Victor Bazarov
    Jun 19, 2007
  5. Replies:
    0
    Views:
    337
Loading...

Share This Page