Fade Image Region with GDI+ ?

L

localhost

I want to read an image from disk, get the total width,
and then find the bottom region (say an area of 120 high
x the total width) and fade-away each pixel by a
percentage to white, and then output that memory-modified
image to the HTTP stream.

Where should I look for info or samples on doing that?

Thanks.
 
K

Kevin Spencer

I doubt you're going to find a sample. However, I think I can give you a
basic idea of what you need to do, and let you run with it from there.
Baiscally, it sounds like what you want to do is to draw a gradient
rectangle over a portion of your image. The gradient rectangle would be
fully-transparent at one end, and fully-white on the other. This would give
you the effect you described. For detailed information about how to use the
System.Drawing Namespace to do this, check out the System.Drawing Namespace
in the .Net SDK.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
S

Steven Cheng[MSFT]

Hi localhost,

Thank you for using Microsoft Newsgroup Service. Based on your description,
you want some instructions or samples on how to operate on a Image grapchic
object in .NET and also you want to output the graphic as a stream to the
http web response.

I think the GDI+ APIS in dotnet provides plentiful functions on Graphic
operations, such as read/write image. And all images can be dealt with as a
Graphic object, you can edit the graphic object's attirbutes in may ways
such as by pixel or by a region area ...
For the detailed instruction and sample, you may visit the tutorial on
DOTNET QuickStart -> Graphic topic, here is the weblink to it:
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsGDIPlus.aspx#Al
pha Blending

As for output a graphic to the http stream, it is as easy as to output a
graphic to a normal IOStream, an here is a good example shows "How to
Optimizing Color Quantization for ASP.NET Images", I believe it'll be
helpful.

http://msdn.microsoft.com/library/en-us/dnaspp/html/colorquant.asp?frame=tru
e

Please have a look at the preceding web tutorials and let know if you need
any help.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top