PDF to single JPEGs then Bytearray

0

I've determined through testing that Texttact handles images with a slight skew infinitely better than PDFs (with embedded images) with the same skew. I'm looking for help converting a multi-page PDF (or many actually) to an image format and have Textract process the concatenated bytearray. Any ideas on how to tackle this? Any sample code out there?

已提問 2 年前檢視次數 233 次
1 個回答
0

The amazon-textract-transformer-pipeline sample shows a scalable batch PDF-to-images converter you might customize for this use case: Check out the code in the notebooks/preproc subfolder and the usage in the "Extract clean input images" section of notebook 1.

The current implementation is based on poppler, pdf2image and processes batches of documents (from Amazon S3) through SageMaker Processing. It's probably not the most efficient possible (Python...), but can scale up to bigger instances (via multiprocessing) and out to multiple instances (via data sharding).

If you needed (near)-real-time processing instead of batch, you could probably get a similar solution running on a containerized Lambda function (poppler requires a lower-level install than pip). In our draft upgrade branch, we instead use SageMaker Asynchronous Inference for this... Because request/response payload sizes and memory could be theoretically very large for documents with many pages.

AWS
專家
Alex_T
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南