I have a sample PPTX slide which has one shape. When I obtain the image of this shape using Aspose, the image is different from the original shape. There are two issues:
a) The text in the PPTX is bold, while the generated image appears in non-bold.
b) The text portion “Adobe Summit 2025” is in a single line in PPTX, while in the image the “2025 for” appears as a separate line.
I am using Aspose 25.5 version.
My code:
using Aspose.Slides;
using Aspose.Slides.Export;
using System.Drawing.Imaging;
using Aspose.Slides.Animation;
using Aspose.Slides.Charts;
using Aspose.Slides.SmartArt;
using Aspose.Slides.Ink;
using System.Drawing;
using System.Drawing.Imaging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Diagnostics;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using Aspose.Slides;
using Aspose.Slides.Animation;
using Aspose.Slides.Charts;
using Aspose.Slides.SmartArt;
using Aspose.Slides.Ink;
using System.Drawing;
using System.Drawing.Imaging;
using System.Threading;
using System.Diagnostics;
using System.Reflection;
using System.IO;
using Aspose.Slides.Export;
class Program
{
static void Main(string[] args)
{
try
{
// Apply Aspose.Slides license
License license = new License();
license.SetLicense("Aspose.Total.lic"); // Make sure this file is in your application's directory
Console.WriteLine("License applied successfully");
// Load the presentation
using (Presentation presentation = new Presentation("sample.pptx"))
{
// Get the first slide as an image
// using (var img = presentation.Slides[0].GetThumbnail(1, 1))
// {
// // Save the image
// img.Save("output.png", System.Drawing.Imaging.ImageFormat.Png);
// Console.WriteLine("Image saved successfully as output.png");
// }
int shapeCounter = 1;
// Loop through all slides
for (int slideIndex = 0; slideIndex < presentation.Slides.Count; slideIndex++)
{
// Get current slide
ISlide slide = presentation.Slides[slideIndex];
// Process each shape in the current slide
foreach (var curShape in slide.Shapes)
{
IAutoShape autoShape = curShape as IAutoShape;
Aspose.Slides.IImage curImage = autoShape.GetImage(0, 2, 2);
// Save the image with a unique name including slide number
string fileName = $"slide_{slideIndex + 1}_shape_{shapeCounter}.png";
curImage.Save(fileName, Aspose.Slides.ImageFormat.Png);
Console.WriteLine($"Image saved successfully as {fileName}");
shapeCounter++;
}
}
}
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
}
It seems that you are experiencing an issue where the generated image of a shape from your PPTX slide does not match the original shape. This can happen due to various reasons, including the method used to extract the image and the version of Aspose.Slides you are using.
To ensure that you are generating the image correctly, you can use the GetImage method of the shape, which allows you to specify the bounds and scaling for the image. Here’s an example of how to extract an image from a shape in a PowerPoint presentation:
using System.Drawing;
using System.Drawing.Imaging;
using Aspose.Slides;
class Program
{
static void Main(string[] args)
{
// Load the presentation
using (Presentation presentation = new Presentation("sample.pptx"))
{
// Access the first slide
ISlide slide = presentation.Slides[0];
// Loop through all shapes in the slide
foreach (IShape shape in slide.Shapes)
{
// Check if the shape is an auto shape
if (shape is IAutoShape autoShape)
{
// Get the image of the shape
using (IImage image = autoShape.GetImage(ShapeThumbnailBounds.Appearance, 1, 1))
{
// Save the image to disk
image.Save("shape_image.png", ImageFormat.Png);
}
}
}
}
}
}
In this example, the GetImage method is used with ShapeThumbnailBounds.Appearance, which captures the appearance of the shape accurately. You can adjust the scaling parameters as needed.
If you continue to see discrepancies between the original shape and the generated image, consider checking the following:
Version Compatibility: Ensure you are using the latest version of Aspose.Slides, as older versions may have bugs or limitations.
Shape Properties: Verify the properties of the shape in the PPTX file, such as effects, gradients, or other styles that may not be rendered correctly in the image.
If the problem persists, please provide more details about the specific differences you are observing, and I can assist you further.
@bhav,
The text in the output image looks different because the Adobe Clean Display Black font used in the PowerPoint presentation is not installed on the operating system where the shape-to-image conversion was performed, and it was therefore substituted with another font.
You should either install the font on that system or use FontsLoader to load it as an external font before the conversion, as shown below:
My machine(Windows 11) has “Adobe Clean Display Black” font installed. How does Aspose detect which fonts are available on the system ?
My code is attached.
Its output is:
Is Adobe Clean Display Black installed (System.Drawing): True
All installed fonts according to System.Drawing:
Found similar font: Adobe Clean
Found similar font: Adobe Clean Black
Found similar font: Adobe Clean Condensed
Found similar font: Adobe Clean Display
Found similar font: Adobe Clean Display Black
Found similar font: Adobe Clean Display ExtraBlack
Found similar font: Adobe Clean Display ExtraBold
Found similar font: Adobe Clean Display ExtraLight
Found similar font: Adobe Clean Display Hairline
Found similar font: Adobe Clean Display Light
Found similar font: Adobe Clean Display Medium
Found similar font: Adobe Clean Display SemiBold
Found similar font: Adobe Clean ExtraBold
Found similar font: Adobe Clean Han
Found similar font: Adobe Clean Han Black
Found similar font: Adobe Clean Han ExtraBold
Found similar font: Adobe Clean Han ExtraLight
Found similar font: Adobe Clean Han HC
Found similar font: Adobe Clean Han HC Black
Found similar font: Adobe Clean Han HC ExtraBold
Found similar font: Adobe Clean Han HC ExtraLight
Found similar font: Adobe Clean Han HC Light
Found similar font: Adobe Clean Han HC Normal
Found similar font: Adobe Clean Han K
Found similar font: Adobe Clean Han K Black
Found similar font: Adobe Clean Han K ExtraBold
Found similar font: Adobe Clean Han K ExtraLight
Found similar font: Adobe Clean Han K Light
Found similar font: Adobe Clean Han K Normal
Found similar font: Adobe Clean Han Light
Found similar font: Adobe Clean Han Normal
Found similar font: Adobe Clean Han SC
Found similar font: Adobe Clean Han SC Black
Found similar font: Adobe Clean Han SC ExtraBold
Found similar font: Adobe Clean Han SC ExtraLight
Found similar font: Adobe Clean Han SC Light
Found similar font: Adobe Clean Han SC Normal
Found similar font: Adobe Clean Han TC
Found similar font: Adobe Clean Han TC Black
Found similar font: Adobe Clean Han TC ExtraBold
Found similar font: Adobe Clean Han TC ExtraLight
Found similar font: Adobe Clean Han TC Light
Found similar font: Adobe Clean Han TC Normal
Found similar font: Adobe Clean Light
Found similar font: Adobe Clean Medium
Found similar font: Adobe Clean SemiCondensed
Found similar font: Adobe Clean SemiLight
Found similar font: Adobe Clean Serif
Found similar font: Adobe Clean Serif Black
Found similar font: Adobe Clean Serif Medium
Found similar font: Adobe Clean Thai
Found similar font: Adobe Clean Thai Blk
Found similar font: Adobe Clean Thai Loop
Found similar font: Adobe Clean Thai Loop Blk
Found similar font: Adobe Clean Thai Loop Lt
Found similar font: Adobe Clean Thai Loop Md
Found similar font: Adobe Clean Thai Loop SemiLt
Found similar font: Adobe Clean Thai Loop XBd
Found similar font: Adobe Clean Thai Lt
Found similar font: Adobe Clean Thai Md
Found similar font: Adobe Clean Thai SemiLt
Found similar font: Adobe Clean Thai XBd
Found similar font: Adobe Clean VF
Found similar font: Adobe Clean VF Black
Found similar font: Adobe Clean VF Condensed
Found similar font: Adobe Clean VF ExtraBold
Found similar font: Adobe Clean VF Light
Found similar font: Adobe Clean VF Medium
Found similar font: Adobe Clean VF Origin
Found similar font: Adobe Clean VF SemiCondensed
Found similar font: Adobe Clean VF SemiLight
Total fonts found: 380
License applied successfully
Exploring Aspose.Slides font handling:
Aspose.Slides font information:
Font substitutions count: 1
Font substitution: Adobe Clean Display Black → Arial
Fonts used in presentation:
Font: Arial
Font: Adobe Clean Black
Font: Adobe Clean
Font: Wingdings
Font: Calibri
Font: Adobe Clean Display Black
Image saved successfully as slide_1_shape_1.png
@bhav,
Thank you for the additional information. I apologize for any inconvenience, but could you please also share a screenshot showing how the text appears in PowerPoint on your end?
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESNET-44967
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The issues you found earlier (filed as SLIDESNET-44967) have been resolved in Aspose.Slides for .NET 25.6 (ZIP, MSI, NuGet, Cross-platform).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.