New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Change Transparency

  • Save Image
  • Opacity
Zoom:100%Size:0x0pxPos.:(-,-)Last Action:None

This example demonstrates how to change the transparency of a given image using the ImageEditor control. Creating an ImageEditorTool with command name Opacity will render a tool on the RadImageEditor's ToolBar that will enable you to modify the picture using the built-in Opacity dialog.
It is, however, not necessary for this tool to be present, for the user to be able to set opacity on her image. The RadImageEditor's changeImageOpacity(opacity) client-side method can be used for this purpose, where the opacity parameter is an integer between 0-100 (percents).

RadImageEditor sets the transparency directly on the client, so the changes are not actually applied to the image until a postback occurs.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
<%@ Page Language="C#" Inherits="Telerik.Web.Examples.ImageEditor.Opacity.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="../../common/styles.css" rel="stylesheet" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-medium">
        <telerik:RadImageEditor RenderMode="Lightweight" ID="RadImageEditor1" runat="server" Width="590px" Height="300px" ImageUrl="~/ImageEditor/images/logo.png">
            <Tools>
                <telerik:ImageEditorToolGroup>
                    <telerik:ImageEditorTool CommandName="Save" IsToggleButton="true"></telerik:ImageEditorTool>
                    <telerik:ImageEditorTool CommandName="Opacity" IsToggleButton="true"></telerik:ImageEditorTool>
                </telerik:ImageEditorToolGroup>
            </Tools>
        </telerik:RadImageEditor>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance