Asp. NET knowledge summary (generic handler for dynamic processing of pictures (CAPTCHA, watermark, thumbnail))

Source: Internet
Author: User

-"Use GDI + to complete the processing of pictures, need to introduce assembly System.Drawing

-" the basic processing model of GDI +

"1" Create canvas Bitmap

"2" Create drawing Tool object Graphics

"3" Call draw***,fill*** Series method to complete the drawing

"4" saved, can be saved to the physical file, can also be saved to the output stream

For use in ashx , you need to specify contenttype= "Image/jpeg";

Use the Save () method output from the canvas object to output to a physical file or output to a stream

Use:

-" example 1: Generate watermark Map "

Idea: Draw a text or small picture on the original image

Example:ASPNET Project Review / /t2_gditest/addwaterof the next day

-" example 2: Generate a verification code

IDEA: Create a canvas, randomly generate characters and draw

Additional function: "Can't see Clearly, change one"

Example:ASPNET Project Review / /t2_gditest/validatecodeof the next day

-" example 3: Thumbnail image "

Idea: Draw the original image to a new diagram and complete the physical save in a scaled-down scale

Example:ASPNET Project Review / /t2_gditest/scaletestof the next day

Asp. NET knowledge summary (generic handler for dynamic processing of pictures (CAPTCHA, watermark, thumbnail))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.