Free Support Forum - aspose.com

EMF to PNG image conversion issue on Linux

Hi Team!

We are extracting images from PowerPoint documents and if the embedded image is a WMF/EMF image we convert it to PNG.

On Linux environment we noticed that some of the texts are overlapping on the PNG image after the conversion and some parts of the text are outside of the image boundaries. On Windows it is working fine.

Could it be a font issue or something else?

The Linux environment:

  • OS: Ubuntu 20.04.2 LTS
  • Aspose.Imaging version: 21.2.0
  • .Net Core SDK version: 3.1.406
  • .Net Core Runtime version: 3.1.12
  • ttf-mscorefonts-installer is also installed

.Net Core Project:
ProcessPresentationImages.zip (2.5 KB)

Test files:
sample_files.zip (2.0 MB)

Extracted and converted images:
extracted_images_as_png.zip (728.4 KB)

List of installed fonts:
font_info.zip (1.2 KB)

@erdeiga

It seems to be more of a font related issue. However, I have created a ticket with ID IMAGINGNET-4356 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

1 Like

There is another issue when I converting WMF image to PNG. After I load the wmf image I noticed that the image Height value is a negative number and it will throw an exception.

I can use the Math.Abs function for a quick fix but I think this is not the expected behavior. Am I right?

Aspose.Imaging.CoreExceptions.ImageSaveException: Image saving failed.
 ---> Aspose.Imaging.CoreExceptions.ImageSaveException: Image export failed.
 ---> System.ArgumentOutOfRangeException: Page size incorrect. Please specify positive values for WmfRasterizationOptions.PageWidth and WmfRasterizationOptions.PageHeight. (Parameter 'options')
   at          (VectorRasterizationOptions )
   at   .[T](VectorRasterizationOptions )
   at  .(Object )
   at  .(Object )
   at  .(MethodBase , Boolean )
   at  .  (  ,   )
   at  .()
   at  .(Boolean )
   at  .(Object )
   at  .(Object )
   at  .()
   at  .(Object , UInt32 )
   at  .(Boolean )
   at  .(Object[] , Type[] , Type[] , Object[])
   at  .(Stream , String , Object[] , Type[], Type[] , Object[] )
   at  .(Stream , String , Object[] )
   at           (VectorRasterizationOptions , Rectangle )
   at Aspose.Imaging.FileFormats.Wmf.WmfImage.kdpagfj68j63c55yfyctsx59qssnqmta    (ImageOptionsBase ,     , Rectangle )
   at    .(VectorImage , ImageOptionsBase , Rectangle )
   at    .       ( , Image , Stream , ImageOptionsBase, Rectangle , Rectangle )
   at    .Export(Image , Stream , ImageOptionsBase , Rectangle)
   at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
   --- End of inner exception stack trace ---
   at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
   at Aspose.Imaging.Image.Save(String filePath, ImageOptionsBase options, Rectangle boundsRectangle)
   --- End of inner exception stack trace ---
   at Aspose.Imaging.Image.Save(String filePath, ImageOptionsBase options, Rectangle boundsRectangle)
   at Aspose.Imaging.Image.Save(String filePath, ImageOptionsBase options)

Project:
ProcessPresentationImages.zip (2.5 KB)

Sample file:
embeddedOleObjects.zip (991.1 KB)

@erdeiga

I have observed the issue and we need to investigate it further on our end. A ticket with ID IMAGINGNET-4372 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

1 Like

@erdeiga

We couldn’t reproduce issue using latest version. Can you please provide extracted image file instead of embeddedOleObjects.pptx?

@erdeiga

Can you please share the following information so that we may proceed further with investigation on our end.

@mudassir.fayyaz,

Sorry for the late answer.

The exception only occurs when I trying to convert the memory stream of the Aspose.Slides IPPImage.BinaryData property. After I load it with Aspose.Imaging from MemoryStream the page size will be {Width=1048, Height=-795}.

When I extract and save the wmf image to wmf format there is no problem with the conversion (wmf to png) because after the Aspose.Imaging load from FileStream the page size will be {Width=1880, Height=999}

Maybe this could be an Aspose.Slides issue?

Extracted images:
extracted_images.zip (437.4 KB)

Aspose.Imaging version: 21.4.0
Aspose.Slides version: 21.4.0

@erdeiga

With your this elaboration, it doesn’t seems to be Aspose.Imaging issue and you may share the similar in Aspose.Slides forum as well.