Click here to Skip to main content
15,891,184 members
Articles / Web Development / ASP.NET

Applying a Color Wash to Images

Rate me:
Please Sign up or sign in to vote.
4.65/5 (18 votes)
15 Dec 2005CPOL7 min read 107.7K   1.1K   54  
This article demonstrates how to apply a color wash to images within .NET, complimenting what's possible with CSS.
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Default.aspx.vb" Inherits="ColorWashExample.ColorWash"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>Color Washing Images</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<meta http-equiv="expires" content="0">
	</HEAD>
	<body>
		<form runat="server" ID="Form1">
			<p>
				Color Wash (RGB Hex Value):&nbsp;<asp:TextBox ID="txtColorWash" MaxLength="6" TextMode="SingleLine" runat="server" />&nbsp;<asp:Button ID="btnColorWash" runat="server" Text="Apply" />
			</p>
			<%If Not Trim(txtColorWash.Text) = Nothing Then%>
			<p>
				Raw Colour:
				<table border="0" cellpadding="0" width="20" height="20">
					<tr>
						<td align="right" style="BACKGROUND-COLOR: #<%=txtColorWash.Text%>"><IMG SRC="Images/Spacer.gif" width="20" height="20"></td>
					</tr>
				</table>
			</p>
			<%End If%>
			<p>
				Original Image:<br>
				<IMG src="Images/Gav.jpg">
			</p>
			<%If Not Trim(txtColorWash.Text) = Nothing Then%>
			<p>
				Color Washed Image:<br>
				<IMG src="Images/Gav.<%=txtColorWash.Text%>.jpg">
			</p>
			<%End If%>
			<!--Hidden control that will allow button to work when [Enter] key is pressed-->
			<div style="visibility:hidden;"><input id="x" name="x" type="text" value="1" style="WIDTH: 0px; HEIGHT: 0px" size="1"/></div>
		</form>
	</body>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
New Zealand New Zealand
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions