We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Blurry and wrongly scaled chart image in generated thumbnail (C# .NET)

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());

Image examples

Snapshot from power point.

@dzielinski,

I have observed the snapshot shared by you. You may try Aspose.Cells to export the chart images as EMF then you can add the EMF images inside slides to get more crisp images. Please visit this Aspose.Slides documentation link to get to know, how to add EMF or EMZ images inside slide.