C # picture Compression processing

Source: Internet
Author: User

Recently in the photo album feature encountered a problem, is to load the picture and then zoom in, feel a little card. The picture may be a bit large, so consider using thumbnails to implement it.

That is, in the query out of an album picture, a page showing dozens of, the dozens of pictures with thumbnails to show, see believe that when the QQ photo album sample loading images to enlarge pull pictures related information. The technology used is the image compression function. Now the functionality has been implemented to see the code.

[CSharp]  View plain  copy  print? using system;   using system.collections.generic;   using  system.componentmodel;   using system.data;   using system.drawing;   using system.linq;   using system.text;   using system.windows.forms;    using system.drawing.imaging;   using system.io;      namespace  WindowsFormsApplication1   {       public partial class  Form1 : Form       {            public form1 ()            {               initializecomponent ();           }      &NBSP;&NBSP;&NBSP;&NBsp;    private void button1_click (Object sender, eventargs e)            {                   string pathperc = @ "D:\ 0046620140807150650cin.jpg ";                string source = @ "G:\0046620140807150650cin.jpg";                if  (! File.exists (PATHPERC))                {                     File.create (PATHPERC). Close ();               }               else               {                    file.delete (PATHPERC);                     File.create (PATHPERC). Close ();               }               getthumimage (Source, 18, 3, &NBSP;PATHPERC);           }               #region  getThumImage            /**/           /// <summary>            ///  generate thumbnails            /// </summary>           ///  <param name= "SourceFile" > Original picture file </param>            /// <param name= "Quality" > Quality compression ratio </param>            /// <param name= "multiple" > shrinkage ratio </param>            /// <param name= "outputfile" > Output filename </param>            /// <returns> Success Returns TRUE, Failure returns false</returns >           public static bool getthumimage (string sourcefile, long quality, 

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.