// Token: 0x060000B8 RID: 184 RVA: 0x0000A0B4 File Offset: 0x000082B4 public static bool MakeThumbnailImage(string fileName, string newFileName, int maxWidth, int maxHeight, int cropWidth, int cropHeight, int X, int Y) { byte[] buffer = File.ReadAllBytes(fileName); Image image = Image.FromStream(new MemoryStream(buffer)); Bitmap bitmap = new Bitmap(cropWidth, cropHeight); bool result; try { using (Graphics graphics = Graphics.FromImage(bitmap)) { graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics.Clear(Color.Transparent); graphics.DrawImage(image, new Rectangle(0, 0, cropWidth, cropHeight), X, Y, cropWidth, cropHeight, GraphicsUnit.Pixel); Image image2 = new Bitmap(bitmap, maxWidth, maxHeight); FPThumb.SaveImage(image2, newFileName, FPThumb.GetCodecInfo("image/" + FPThumb.GetFormat(newFileName).ToString().ToLower())); result = true; } } catch (Exception ex) { throw ex; } finally { image.Dispose(); bitmap.Dispose(); } return(result); }
// Token: 0x060000B2 RID: 178 RVA: 0x00009CE8 File Offset: 0x00007EE8 public static void MakeSquareImage(Image image, string newFileName, int newSize) { int width = image.Width; int height = image.Height; if (width > height) { } Bitmap bitmap = new Bitmap(newSize, newSize); try { Graphics graphics = Graphics.FromImage(bitmap); graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics.Clear(Color.Transparent); if (width < height) { graphics.DrawImage(image, new Rectangle(0, 0, newSize, newSize), new Rectangle(0, (height - width) / 2, width, width), GraphicsUnit.Pixel); } else { graphics.DrawImage(image, new Rectangle(0, 0, newSize, newSize), new Rectangle((width - height) / 2, 0, height, height), GraphicsUnit.Pixel); } FPThumb.SaveImage(bitmap, newFileName, FPThumb.GetCodecInfo("image/" + FPThumb.GetFormat(newFileName).ToString().ToLower())); } finally { image.Dispose(); bitmap.Dispose(); } }
// Token: 0x060000B7 RID: 183 RVA: 0x00009EE4 File Offset: 0x000080E4 public static void MakeThumbnailImage(string fileName, string newFileName, int width, int height, string mode) { Image image = Image.FromFile(fileName); int num = width; int num2 = height; int x = 0; int y = 0; int num3 = image.Width; int num4 = image.Height; if (mode != null) { if (!(mode == "HW")) { if (!(mode == "W")) { if (!(mode == "H")) { if (mode == "Cut") { if ((double)image.Width / (double)image.Height > (double)num / (double)num2) { num4 = image.Height; num3 = image.Height * num / num2; y = 0; x = (image.Width - num3) / 2; } else { num3 = image.Width; num4 = image.Width * height / num; x = 0; y = (image.Height - num4) / 2; } } } else { num = image.Width * height / image.Height; } } else { num2 = image.Height * width / image.Width; } } } Bitmap bitmap = new Bitmap(num, num2); try { Graphics graphics = Graphics.FromImage(bitmap); graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics.Clear(Color.Transparent); graphics.DrawImage(image, new Rectangle(0, 0, num, num2), new Rectangle(x, y, num3, num4), GraphicsUnit.Pixel); FPThumb.SaveImage(bitmap, newFileName, FPThumb.GetCodecInfo("image/" + FPThumb.GetFormat(newFileName).ToString().ToLower())); } catch (Exception ex) { throw ex; } finally { image.Dispose(); bitmap.Dispose(); } }