Extract Image from PDF on Linux

Hi
I am using aspose-total-net 24.1.0 (python) to extract images from the pdf. Iam running the code on Debian GNU/Linux 11 (bullseye) using Python 3.11.10. However when I run the below code

document = ap.Document(“embedded_pdf_1.pdf”)

xImage = document.pages[2].resources.images[1]
outputImage = io.FileIO(“sample.jpg”, “w”)

xImage.save(outputImage)
outputImage.close()

I am getting the below error. However on Windows it is working perfectly fine

xImage.save(outputImage)
RuntimeError: Proxy error(NotImplementedException): Not supported image type

Please help

@deepakbs

It seems that you are encountering a RuntimeError when trying to extract images from a PDF using Aspose.PDF on a Linux environment. The error message indicates that the image type you are trying to save is not supported.

Here are a few steps you can take to troubleshoot and resolve this issue:

  1. Check Image Type: Ensure that the image you are trying to extract is of a supported type. Aspose.PDF supports various image formats, but some formats may not be supported on all platforms. You can check the type of the image before saving it.

  2. Use a Different Output Stream: Instead of using io.FileIO, try using a different method to create the output stream. For example, you can use open() with the ‘wb’ mode to write binary data:

    with open("sample.jpg", "wb") as outputImage:
        xImage.save(outputImage)
    
  3. Update Aspose.PDF: Ensure that you are using the latest version of Aspose.PDF for Python. Sometimes, issues are resolved in newer releases, so updating might help.

  4. Check for Dependencies: Make sure that all necessary dependencies for Aspose.PDF are installed and properly configured on your Linux system.

  5. Consult Documentation: Review the Aspose.PDF documentation for any platform-specific notes regarding image extraction. There may be additional requirements or limitations when running on Linux.

If the issue persists after trying these steps, consider reaching out to the Aspose support team or checking the Aspose forums for similar issues encountered by other users.

Feel free to ask if you need further assistance!

Sources:
[1]: Extract Images From PDF File | Aspose.PDF for .NET API Reference

None of the above suggestions is working

@deepakbs

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): PDFPYTHON-308

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.