Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have received a number of pdf files with images in them. The original images have been lost, so I need to extract them. I have Adobe Acrobat Pro, so I extracted them using Advanced > Document Processing > Export All Images (there are four options: jpeg, png, tiff, jpeg2000). But, I'd like to extract them in the original format, and this is apparently not jpeg: I also tested pdfimages.exe from xpdf as outlined here, and this gave .ppm files, not jpeg.

So I tried ImageMagick's identify, what it gave me was this:

identify images-000.ppm
images-000.ppm PPM 870x1181 870x1181+0+0 8-bit sRGB 3.082MB 0.000u 0:00.000

Does this indicate it was an embedded .bmp? How to tell? I would actually expect a function in Acrobat to identify the format of images, but I couldn't find it.

So, what is the best way to identify the image format of images in a pdf?

(I prefer extraction via Acrobat because of the batch functionality).

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

AFAIK, the Image XObjects embedded inside PDFs do not store any information about the original image format. At most if it's an embedded JPEG it can be extracted as-is, but for all other cases you end up with a PxM image that you'll need to convert.

share|improve this answer
add comment

The picture is in portable pixmap file format. (See Wikipedia: Netpbm format for details).

The can use the netbmp tools to convert these to a more modern bmp.
The syntax for that is: ppmtobmp images-000.ppm > images-000.bmp.

http://netpbm.sourceforge.net/ is the homepage for netpbm.

Are there multiple images in a document? Or can we just search the PDF for the line with identify images-000.ppm, cut the file from that location and feed it to ppmtobmp? It should not be hard to automate that.

share|improve this answer
    
I guess that makes sense, since pdfimages.exe saved them as pixmap. What I actually want is to find out the image format of the embedded images. Yes, there are multiple images in the pdf. –  arjan Nov 21 '12 at 14:42
1  
The current image format in the PDF is pixmap (of JFIF). The original format is not retained. If you want the original format you will have to get the original files, or save the pictures (using pdfimages) and then convert and rename them. –  Hennes Nov 21 '12 at 15:12
    
So I was looking for information that just isn't in the pdf. Good to know. –  arjan Nov 21 '12 at 15:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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