Modify the resolution of a specified picture

Source: Internet
Author: User

 #regionModify the resolution of a specified picture/// <summary>          ///Modify the resolution of a specified picture/// </summary>          /// <param name= "Filefoldurl" >folder URL</param>          /// <param name= "FileName" >file name</param>          /// <param name= "FilePath" >file path, with file name</param>          /// <param name= "_width" >width of the resolution</param>          /// <param name= "_height" >resolution of High</param>           Public Static voidUpdate_picture (stringFilefoldurl,stringFileName,stringFilePath,int_width,int_height) {            Try            {                byte[] ZP =load_pictmemory (FilePath); MemoryStream Ms=NewMemoryStream (ZP); System.Drawing.Image img=System.Drawing.Image.FromStream (MS); Bitmap BTP=NewBitmap (IMG, _width, _height); DirectoryInfo DTI=NewDirectoryInfo (Filefoldurl); fileinfo[] FIS=DTI.                GetFiles (); stringFILEURL = Filefoldurl +FileName; Btp.            Save (FILEURL); }            Catch(Exception) {Throw; }        }        /// <summary>          ///gets the byte size of the specified file stream/// </summary>          /// <param name= "FilePath" >file path</param>          /// <returns>byte[]</returns>           Public Static byte[] Load_pictmemory (stringFilePath) {            byte[] Pictdata =NULL; FileInfo fi=NewFileInfo (FilePath); if(FI. Exists) {Pictdata=New byte[FI.                Length]; FileStream FS=NewFileStream (FilePath, FileMode.Open, FileAccess.ReadWrite); BinaryReader BR=NewBinaryReader (FS); Br. Read (Pictdata,0, Convert.ToInt32 (FI.                Length)); Fs.            Dispose (); }            Else{HttpContext.Current.Response.Write ("<script language= ' javascript ' >alert (' did not find the picture you specified ') </script>"); }            returnPictdata; }        #endregion

Modify the resolution of a specified picture

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.