Quick Dropshadow
The Code: shadow.aspx
<%@ Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import Namespace="system.drawing" %>
<%@ Import Namespace="system.drawing.imaging" %>
<%@ Import Namespace="system.drawing.drawing2d" %>
<%@ Import Namespace="system.io" %>
<script runat="server">
dim Filename as String
dim Width, Height, shadowSize as Integer
dim Bitmap as system.drawing.bitmap
dim Graphix as Graphics
dim ImgFormat as ImageFormat
dim Img as System.Drawing.Image
Dim baseMap as Bitmap
dim top, left as Integer
sub CreateGraphic()
Filename = Request.QueryString("filename")
Filename = server.mappath(Filename)
ImgFormat = ImageFormat.jpeg : response.contenttype="image/jpeg"
Img = system.drawing.image.FromFile(Filename)
Width = Img.Width
Height = Img.Height
shadowSize = 10
baseMap = new Bitmap(Width+shadowSize,Height+shadowSize)
Dim myGraphic as Graphics = Graphics.FromImage(baseMap)
with myGraphic
.FillRectangle(new SolidBrush(Color.white), 0, 0, Width+shadowSize, Height+shadowSize)
.FillRectangle(new SolidBrush(Color.darkgray), 10, 10, Width+shadowSize, Height+shadowSize)
.FillRectangle(new SolidBrush(Color.black), 0, 0, Width+6, Height+6)
.DrawImage(Img, 2,2, Width+2,Height+2)
end with
Img.dispose()
end sub
</script>
<%
CreateGraphic
baseMap.Save(Response.OutputStream, ImageFormat.JPEG)
baseMap.dispose()
Img = Nothing
response.end
%>
Usage
<img src="shadow.aspx?filename=FILENAME.JPG" />
Example