Image quality is low

Hi,


I’m trying to export powerpoint slide as image using Aspose.Slides for .NET (version 17.1.0.0).
Firstly, I tried to get the image with the following code:

private Image GetSlideImage(ISlide slide, float scaleX, float scaleY)
{
var slideImage = slide.GetThumbnail(scaleX, scaleY);
return slideImage;
}

but the image quality is really bed. Please see attached image “Aspose thumbnail.png” (logo on the right bottom corner)

Then, I tried to set resolution and set some more properties for quality:

private Image GetSlideImage(ISlide slide, Size size)
{
var scale = 1f;
if (size.Width > 0)
scale = size.Width / slide.Presentation.SlideSize.Size.Width;

var thumbnail = slide.GetThumbnail(scale, scale);

var image = ResetResoulution(thumbnail, 300);

var mfImage = resizeImage(image, new Size(size.Width, size.Height));
return mfImage;

}

private Image ResetResoulution(Bitmap thumbnail, float resolution)
{

int width1 = (int)(thumbnail.Width * resolution / thumbnail.HorizontalResolution);
int height1 = (int)(thumbnail.Height * resolution / thumbnail.VerticalResolution);


Bitmap bmp = new Bitmap(width1, height1);
bmp.SetResolution(resolution, resolution);

using (Graphics g = Graphics.FromImage(bmp))
{
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;

g.DrawImage(thumbnail, Point.Empty);
}
return bmp;
}

private static Image resizeImage(Image imgToResize, Size size)
{
var scaledBitmap = new Bitmap(size.Width, size.Height, PixelFormat.Format32bppArgb);

using (var g = Graphics.FromImage(scaledBitmap))
{

var attr = new ImageAttributes();
attr.SetWrapMode(WrapMode.TileFlipXY);
g.CompositingQuality = CompositingQuality.HighQuality;
g.CompositingMode = CompositingMode.SourceCopy;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.SmoothingMode = SmoothingMode.AntiAlias;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;

g.DrawImage(imgToResize, new Rectangle(0, 0, size.Width, size.Height), 0, 0, imgToResize.Width, imgToResize.Height, GraphicsUnit.Pixel, attr);
}


return scaledBitmap;

}

But I get the same quality as previously. No changes.
Any advice on how the quality can be improved?

P.S I also attached the presentation I was trying with.

Looking forward for solution.

Regards,
Aleksandra

Hi,


I have observed your comments. I like to inform that in general thumbnail quality depends on objects in thumbnail. But in any case if you decrease source picture you’ll get less picture with better quality. Source picture you create by GetThumbnail(). For example:
Bitmap bmp = slide.GetThumbnail(5f, 5f);
Bitmap res = new Bitmap(720, 540); //for example. You can set your own size
using (var g = Graphics.FromImage(res))
{
g.DrawImage(bmp, new Point());
}
bmp.Save(“res.png”, ImageFormat.Png);
System.Diagnostics.Process.Start(“res.png”);
Please share feedback with us if there is still an issue.

Best Regards,

Thanks for the prompt reply.


I’ve tried as you suggested, but I can’t see a difference in the quality.
I’ve noticed that Aspose.Slide version 17.1 generates better images that version 16. But with v17 there are issues that didn’t appear with v16. I will open a new discussion about them.

Thanks and regards,
Aleksandra

Hi Aleksandra,


I have observed your comments. Surely we will help you to resolve your issues.

Best Regards,