From today morning, we are experiencing issues in the time taken to convert a Powerpoint slide to Image (PNG). Earlier it used to be a few seconds to a minute depending on the number of slides, but since today morning, the time required is well over 5 minutes. Is there some server issue happening?
Could you please provide more details about the environment you are using, such as the version of Aspose.Slides and the specifications of the server?
I am using asposeslidescloud
python library version 24.12.0
. We have been using this version for quite a long time and today is the first time we are experiencing such issues.
@softwarets,
Could you please share a sample presentation file and code example to reproduce the problem on our end?
@andrey.potapov Here is the code:
import asposeslidescloud
from asposeslidescloud.models.image_export_options import ImageExportOptions
from asposeslidescloud.models.export_format import ExportFormat
import os, shutil
from pptx import Presentation
CLIENT_ID = os.getenv("CLIENT_ID")
CLIENT_SECRET = os.getenv("CLIENT_SECRET")
def calculate_aspect_fit(original_width, original_height, target_width, target_height):
"""
Calculates the new dimensions to fit an original size into a target bounding box
while preserving the original aspect ratio.
:param original_width: Width of the original image/slide.
:param original_height: Height of the original image/slide.
:param target_width: The maximum width of the output image.
:param target_height: The maximum height of the output image.
:return: A tuple of (new_width, new_height) as integers.
"""
original_ratio = original_width / original_height
target_ratio = target_width / target_height
if original_ratio > target_ratio:
# Original is wider than the target box, so the new width is the target width
new_width = target_width
new_height = new_width / original_ratio
else:
# Original is taller than or equal to the target box, so the new height is the target height
new_height = target_height
new_width = new_height * original_ratio
return int(round(new_width)), int(round(new_height))
# initialize Aspose.Slides Cloud instance.
configuration = asposeslidescloud.Configuration()
configuration.app_sid = CLIENT_ID
configuration.app_key = CLIENT_SECRET
slidesApi = asposeslidescloud.SlidesApi(configuration)
# load PPT file from local drive into Stream instance
fileName = "Prototyping presentation.pptx"
presentation = Presentation(fileName)
print(f"Number of slides in presentation: {len(presentation.slides)}")
num_pptx_slides = len(presentation.slides)
width = presentation.slide_width
height = presentation.slide_height
print(f"Slide dimensions are : width = {width}, height = {height}")
# Calculate new dimensions to fit the slide into a 1280x720 box
new_width, new_height = calculate_aspect_fit(width, height, 1280, 720)
print(f"New dimensions such that the slides fit into the canvas are: width = {new_width}, height = {new_height}")
with open(fileName, 'rb') as f:
file = f.read()
options = ImageExportOptions()
options.width = new_width
options.height = new_height
options.show_hidden_slides = True
thread = slidesApi.convert(file, format=ExportFormat.PNG, options=options, fonts_folder="custom_fonts", is_async=True)
path = thread.get()
print(f"File converted to {path}")
I am unable to upload a ppt file as your platform is not allowing me to select a ppt file during upload.
This is the response time for a recent call we made:
Number of slides in presentation: 14
Slide dimensions are : width = 9144000, height = 5143500
New dimensions such that the slides fit into the canvas are: width = 1280, height = 720
File converted to /var/folders/pr/5hd34jwj5l76b0spq6s98gbr0000gn/T/converted_1.zip
Total time taken 188.51037168502808 seconds
@andrey.potapov Please let us know if this is a server issue from your side and if that’s the case, some ETA till when this will be fixed, we have customers who are facing problems using our platform due to this.
@softwarets,
Thank you for the code example.
You can zip the file and upload the archive here. Alternatively, you can share a link to the file stored in a file storage (Google Drive, Dropbox, etc.).
We need some time to investigate the case. We would greatly appreciate it if you could share the presentation file.
@andrey.potapov Here is the file for your reference:
I tried to upload it as a zip file (17.2 Mb) but it gave me an error that the file size is higher than the limit of 48.8 Mb (weird how 17 Mb is being considered bigger than 48 Mb)
@softwarets,
Thank you for the sample presentation file. Unfortunately, I was unable to reproduce the problem. It takes ~20 sec on my end. Could you please check the issue carefully again? Is this a one-time occurrence, or does the code consistently take around five minutes per run?
@andrey.potapov It is consistently taking around 5 minutes to run.
This is the result for the same file right now:
Number of slides in presentation: 14
Slide dimensions are : width = 9144000, height = 5143500
New dimensions such that the slides fit into the canvas are: width = 1280, height = 720
File converted to /var/folders/pr/5hd34jwj5l76b0spq6s98gbr0000gn/T/converted_1.zip
Total time taken 241.35590505599976 seconds
Its becoming a big issue for us. Did you check with the same version of python library (24.12.0
) that I am using?
@softwarets,
Thank you for the confirmation. I was checking the issue with the same version. Could you please share the font files from the folder fonts_folder
?
@andrey.potapov Custom fonts are very important to our customers, we can’t exclude those. And we have been using custom fonts for a long time, we have not experienced this kind of latency before.
@softwarets,
Could you run the code example in a separate application, both with and without the fonts, and measure the time taken?