Try { //Get picture sizeSystem.Drawing.Size Size =NewSystem.Drawing.Size (Convert.ToInt32 (w), Convert.ToInt32 (h)); //Create a new BMP imageSystem.Drawing.Image BMP =NewSystem.Drawing.Bitmap (size. Width, size. Height); //Create a new artboardg =System.Drawing.Graphics.FromImage (BMP); //setting high-quality interpolation methodsG.interpolationmode =System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear; //set high quality, low speed rendering smoothnessG.smoothingmode =System.Drawing.Drawing2D.SmoothingMode.HighQuality; //clear the canvas .g.clear (System.Drawing.Color.Transparent); //draw at the specified locationG.drawimage (IMG,NewSystem.Drawing.Rectangle (0,0Bmp. Width, BMP. Height),NewSystem.Drawing.Rectangle (Cwidth/2, Cheigh_h/2Img. Width-cwidth, IMG. Height-cheigh_h), System.Drawing.GraphicsUnit.Pixel);//Cwidth to crop the dimensions//save high-definition thumbnail imagesbmp. Save (Newmappath, System.Drawing.Imaging.ImageFormat.Jpeg); } finally{g.dispose (); }
related parameters:smoothingmode {The edges of lines, curves, and filled areas are aliased, and it does not control the path gradient brush}invalid//an invalid modeDefault//no anti-aliasing, equivalent to Highspeed, NoneHighspeed//no anti-aliasingHighquality//Anti -aliasing, equivalent to AntiAliasNone//no anti-aliasingAntiAlias//Anti- aliasing interpolationmode {interpolation mode determines how intermediate values between two pixel points are calculated}invalid//the Invalid element that is equivalent to the Qualitymode enumeration.Default//The default mode.Low//low quality interpolation method.High//high-quality interpolation method.Bilinear//bilinear interpolation; This mode does not apply when the image is shrunk to the original size of 50%.Bicubic//dual three-time interpolation, no pre-filtering, and shrinking the image to the original size of 25% when this mode does not apply.Nearestneighbor//the nearest interpolation method.Highqualitybilinear//High-quality bilinear interpolation; Perform pre-screening to ensure high-quality shrinkage.Highqualitybicubic//High-quality double three-time interpolation; performs pre-screening to ensure high quality shrinkage and produces the highest quality conversion image. compositingmode {color compositing mode}sourceover//mixed with background color; The blend is determined by transparencySourceCopy//Overwrite background color compositingquality {The source pixel and the target pixel and the composition method}invalid when the image is synthesized//Invalid qualityDefault//Default QualityHighspeed//high speed, low qualityHighquality//high-quality, low-speed compoundinggammacorrected//using grayscale correctionAssumelinear//assuming a linear value pixeloffsetmode {pixel offset mode}invalid//Invalid mode.Default//The default mode.Highspeed//high speed, low quality rendering.Highquality//high-quality, low-speed rendering.None//There is no pixel offset.Half//pixels are offset by 0.5 units at both horizontal and vertical distances for high-speed sawtooth elimination.