Someone used (probably) Adobe Professional OCR feature to OCR a scanned pdf file. The OCRed result had some errors, and it added the text result back to the text image in the pdf file, covering the actual text image, so I can't tell what the correct one that the text image shows

Can I recover the original image of text after processing by adobe professional OCR? Thanks.


You can easily list or extract all images from a PDF (or just from a specific page range) using the command line tool pdfimages. This tool is available for Linux, Unix, Mac OS X and Windows.

 pdfimages -list -f 3 -l 7 my.pdf

Above command lists all the images from page 3 (-f "first") to page 7 (-l "last") without extracting them.

The most recent versions of pdfimages do even include additional info, such as width/height dimensions of the image, compression ratio, color space, bit depth, image encoding and resulting resolution as compared to the PDF page's own size:

kp@mbp:> pdfimages -list -f 3 -l 7 porsches-a4.pdf
 page   num  type   width height color comp bpc  enc interp  object ID x-ppi y-ppi size ratio
    3     0 image    1920  1440  rgb     3   8  jpeg   no        20  0   175   175  182K 2.2%
    4     1 image    1920  1440  rgb     3   8  jpeg   no        26  0   175   175  130K 1.6%
    5     2 image    1920  1440  rgb     3   8  jpeg   no        32  0   175   175 92.1K 1.1%
    6     3 image    1920  1440  rgb     3   8  jpeg   no        38  0   175   175  233K 2.9%
    7     4 image    1920  1440  rgb     3   8  jpeg   no        44  0   175   175  238K 2.9%

To extract a specific page's images as JPEGs use the -j parameter:

kp@mbp:> pdfimages -j -f 11 -l 11 porsches-a4.pdf prefix

This would extract all images from page 11. Their names would be prefix-000.jpg, prefix-001.jpg, prefix-002.jpg etc.

NOTE: Sometimes direct extraction as JPEG isn't possible. pdfimages will still extract them, albeit in PNM or PPM format. You can easily convert these to PNG or JPEG by using ImageMagick's convert command:

 convert some.ppm some.png
 convert some.pnm some.jpg

If the images are still present, it is possible to extract them. You could use Photoshop or a tool like this: http://www.somepdf.com/some-pdf-image-extract.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.