. Net to automatically scale down or zoom in the proportion of uploaded images,. net to upload images
This example shows how to automatically scale down or zoom in the proportion of images Uploaded By. Net. It is a very practical function. Share it with you for your reference. The specific method is as follows:
//// <Summary> /// scale down the image proportionally, automatically calculate the width /// </summary> /// <param name = "strOldPic"> source image file name (including path) </param> /// <param name = "strNewPic"> zoom out and save it as a file name (including a path) </param> /// <param name = "intHeight"> zoom down to height </param> public void SmallPicWidth (string strOldPic, string strNewPic, int intHeight) {System. drawing. bitmap objPic, objNewPic; try {objPic = new System. drawing. bitmap (strOldPic); int intWidth = (intHeight/objPic. height) * objPic. width; objNewPic = new System. drawing. bitmap (objPic, intWidth, intHeight); objNewPic. save (strNewPic);} catch (Exception exp) {throw exp;} finally {objPic = null; objNewPic = null ;}} /** /// <summary> // zoom out the image // </summary> /// <param name = "strOldPic"> source image file name (including path) </param> /// <param name = "strNewPic"> zoom out and save it as a file name (including a path) </param> /// <param name = "intWidth"> width </param> /// <param name = "intHeight"> height </param> public void SmallPic (string strOldPic, string strNewPic, int intWidth, int intHeight) {System. drawing. bitmap objPic, objNewPic; try {objPic = new System. drawing. bitmap (strOldPic); objNewPic = new System. drawing. bitmap (objPic, intWidth, intHeight); objNewPic. save (strNewPic);} catch (Exception exp) {throw exp;} finally {objPic = null; objNewPic = null ;}}
We hope that the examples described in this article will provide some reference value for your asp.net program design.
Who has the net image automatically scaled out source code?
It's easy to wait for proportional scaling. The idea is that the length or width is fixed, and the other side is calculated based on the scaling ratio, and then a thumbnail is generated according to the common scaling method.
Programming (C #, C, C ++, java, and Net can be used in any language) to import images, zoom in and out, and display the magnification of zoom in and out.
Includes the following programming:
[Image decoding]
There is no specified format for image enlargement. Therefore, various compression, orchestration, format, and color depth must be processed.] How can we deal with the blocking effect of image enlargement? You need to compare and select the process, and then there are many methods and effects;
Image Display] The window needs to be opened to enlarge the image. The display range is determined based on the pixel depth of the current window and the display device of the border. We are also concerned about Image Browsing operations, using the scroll bar when you view some image-related operations.