In this below code i am setting thumbnail image pixel size as 395 x 254, but once it’s created the thumbnail image the size looks different 527 x 339.
Aspose.Words.Document doc = new Aspose.Words.Document(docStream);
// Render first page of Word document to an image stream
Aspose.Words.Saving.ImageSaveOptions options = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Png);
options.PageIndex = 0;
options.PageCount = 1;
MemoryStream imgStream = new MemoryStream();
doc.Save(imgStream, options);
// Insert the image stream into a temporary Document instance.
Aspose.Words.Document temp = new Aspose.Words.Document();
DocumentBuilder builder = new DocumentBuilder(temp);
Aspose.Words.Drawing.Shape img = builder.InsertImage(imgStream);
// Resize the image as per your needs
img.Width = 395;
img.Height = 254;
// Save the individual image to disk using ShapeRenderer class
ShapeRenderer renderer = img.GetShapeRenderer();
MemoryStream outStream = new MemoryStream();
renderer.Save(outStream, new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Png));
bytes = outStream.GetBuffer();
return bytes;