Aspose.Slides 20.2
Aspose.Cells 20.2
System.Drawing 4.7
Why does the image get blurry?
Example image and how it is displayed in power point attached.
Sample code excerpt:
int height = ole.SubstitutePictureFormat.Picture.Image.SystemImage.Height;
int width = ole.SubstitutePictureFormat.Picture.Image.SystemImage.Width;
float horizontalRes = ole.SubstitutePictureFormat.Picture.Image.SystemImage.HorizontalResolution;
float verticalRes = ole.SubstitutePictureFormat.Picture.Image.SystemImage.VerticalResolution;
…
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.OnePagePerSheet = true;
options.SetDesiredSize(width, height);
options.ImageType = Aspose.Cells.Drawing.ImageType.Png;
options.PageCount = 1;
options.Transparent = true;
options.CheckWorkbookDefaultFont = true;
options.HorizontalResolution = (int)(horizontalRes);
options.VerticalResolution = (int)(verticalRes)
options.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
options.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
// options.OnlyArea = true;
// options.IsCellAutoFit = true;
SheetRender sr = new SheetRender(sheet, options);
sr.ToImage(0, imageStream);
// Image img = Image.FromStream(imageStream);
// Image scaledImage = ScaleImage(img, width, height, x, y);
// scaledImage.Save(scaledImageStream, ImageFormat.Png);
ole.SubstitutePictureFormat.Picture.Image.ReplaceImage(imageStream.ToArray());
Snapshot from power point.