![]() Graphics.CompositingQuality = CompositingQuality.HighQuality Draws the image in the specified size with quality mode set to HighQuality using (Graphics graphics = Graphics.FromImage(newImage)) Convert other formats (including CMYK) to RGB.īitmap newImage = new Bitmap(newWidth, newHeight, PixelFormat.Format24bppRgb) Int newHeight = ( int)(originalHeight * ratio) New width and height based on aspect ratio int newWidth = ( int)(originalWidth * ratio) ![]() To preserve the aspect ratio float ratioX = ( float)maxWidth / ( float)originalWidth įloat ratioY = ( float)maxHeight / ( float)originalHeight ![]() Get the image's original width and height int originalWidth = image.Width public void Save(Bitmap image, int maxWidth, int maxHeight, int quality, string filePath) / /// Method to resize, convert and save the image. / /// Class contaning method to resize an image and save in JPEG format
0 Comments
Leave a Reply. |