Dynamic Color Shifting
The Code: colorshift.aspx
<%@ Page Explicit="True" Language="VB" Debug="True" %> <%@ import namespace="system.drawing" %> <%@ import namespace="system.drawing.imaging" %> <%@ Import Namespace="system.io" %> <script runat="server"> Dim Filename dim Img as System.Drawing.Bitmap dim x,y,h,w,l,s as Integer sub CreateGraphic() Filename = Request.QueryString("filename") Filename = server.mappath(Filename) Img = system.drawing.bitmap.FromFile(Filename) s = Request.QueryString("s") h = Img.height w = Img.width for y = 1 to h-1 for x = 1 to w-1 Dim c as Color = Img.GetPixel(x,y) l = CInt(c.R*0.3 + c.G*0.59 + c.B*0.11) if s = 0 then '0 = GRAYSCALE Img.SetPixel(x,y,Color.FromArgb(l,l,l)) elseif s = 1 then '1 = RED Img.SetPixel(x,y,Color.FromArgb(l,0,0)) elseif s = 2 then '2 = GREEN Img.SetPixel(x,y,Color.FromArgb(0,l,0)) elseif s = 3 then '3 = BLUE Img.SetPixel(x,y,Color.FromArgb(0,0,l)) elseif s = 4 then '4 = PURPLE Img.SetPixel(x,y,Color.FromArgb(l,0,l)) elseif s = 5 then '5 = YELLOW Img.SetPixel(x,y,Color.FromArgb(l,l,0)) elseif s = 6 then '6 = BLUE-GREEN Img.SetPixel(x,y,Color.FromArgb(0,l,L)) end if next next end sub </script> <% CreateGraphic Img.Save(Response.OutputStream, ImageFormat.JPEG) Img.dispose() response.end %>
Usage
<img src="colorshift.aspx?filename=FILENAME.JPG&s=CHOOSE 0 THRU 6 SEE CODE" />
Example
Comments
Rahul
5/17/2005 10:45:30 AM
Its good asp code nice script
Rahul
5/17/2005 10:47:08 AM
Its good asp code nice script
Web 2.0
12/13/2006 11:50:54 AM
Kewl effect.
AL badwawi
5/10/2007 6:30:04 AM
nice script..thanks
Comments Disabled For Now
Name:
URL:
Comments:
Posts
Latest
Advice (5)
API (2)
ASP.NET (11)
Blogging (2)
Browsers (5)
Classic ASP (1)
Design (1)
Ecommerce (3)
GDI+ (7)
Handy Stuff (4)
IIS (1)
Misc (8)
Money (8)
Opinion (8)
Side Projects (1)
Swish (12)
VBS (3)
Stores
Books
Software
Video Games
Plasma TVs
LCD TVs
DVD Players
Tivo & DVR
HDTVs
MP3 Players
Camcorders
Cameras
Cell Phones
Desktops
Laptops
USB Flash Drives
Hard Drives
LATEST POSTS
Viewstate
bad developer, bad.
Animation != Application
Frame-based illiteration engulfs world. Developers worldwide cry.
Handy ASP.NET Routines
Bullshit Talks
But money wont shut the hell up.
PostBackUrl Equals Change the Friggin' Form Action
.
ADS
MOST POPULAR
Multiple IEs in Windows
Firefox Vs. The World
Who Is Xperya?
ActionScript Form Fields
Quick Watermark
IE 7 beta 2 standalone
IP Address Tool
Chicago Web Design
Free Text Messaging
5/17/2005 10:45:30 AM Its good asp code nice script