pdfimages(1)

๐Ÿ“ฆ
version 26.07.0 ยท 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

๐Ÿ’– pdfimages(1) ๐Ÿ’–

โœจ General Commands Manual โœจ

๐Ÿฆ‹ NAME

okay so pdfimages is the Portable Document Format (PDF) image extractor (version 3.03) ๐Ÿ’…

๐ŸŽ€ SYNOPSIS

pdfimages [options] PDF-file image-root

๐ŸŒธ DESCRIPTION

bestie, pdfimages lowkey rescues images out of a Portable Document Format (PDF) file ๐Ÿซถ It can save them as Portable Pixmap (PPM), Portable Bitmap (PBM), Portable Network Graphics (PNG), Tagged Image File Format (TIFF), JPEG, JPEG2000, or JBIG2 files โœจ

so it reads the PDF file PDF-file, scans one or more pages, and writes one file for each image, named image-root-nnn.xxx ๐Ÿ“ where nnn is the image number and xxx is the image type (.ppm, .pbm, .png, .tif, .jpg, jp2, jb2e, or jb2g). ๐Ÿ™ˆ And if PDF-file is -, it reads the PDF from stdin instead ๐Ÿงš

the default output format is PBM for monochrome images, or PPM for non-monochrome ones ๐ŸŒˆ the -png or -tiff options switch the default to PNG or TIFF, respectively. if you specify both -png and -tiff, CMYK images get written as TIFF and everything else comes out as PNG ๐Ÿ’œ and the -j, -jp2, and -jbig2 options will write JPEG, JPEG2000, and JBIG2 images from the PDF in their native format ๐Ÿ”ฅ

๐Ÿ’… OPTIONS

  • -f number โ€” pick the first page to scan ๐ŸŒท
  • -l number โ€” pick the last page to scan ๐ŸŒท
  • -png โ€” switch the default output format to PNG ๐Ÿ“
  • -tiff โ€” switch the default output format to TIFF ๐Ÿ“
  • -j โ€” write JPEG images as JPEG files instead of the default format. the JPEG file is identical to the JPEG data stored in the PDF ๐Ÿ“ธ
  • -jp2 โ€” write JPEG2000 images as JP2 files instead of the default format. the JP2 file is identical to the JPEG2000 data stored in the PDF ๐Ÿ“ธ
  • -jbig2 โ€” write JBIG2 images as JBIG2 files instead of the default format. the JBIG2 data in the PDF is the embedded type ๐Ÿฆ‹ embedded JBIG2 can have an optional separate file holding global data. the embedded data gets the extension .jb2e, and the global data (if there is any) goes to the same image number with the extension .jb2g โœจ the content of both files matches the JBIG2 data in the PDF ๐Ÿ’–
  • -ccitt โ€” write CCITT images as CCITT files instead of the default format. the CCITT file is identical to the CCITT data stored in the PDF ๐Ÿง PDF files also carry extra parameters telling you how to decode the CCITT data. those get translated into fax2tiff input options and written to a .params file with the same image number ๐Ÿ“ the parameters are:
    • -1 โ€” 1D Group 3 encoding
    • -2 โ€” 2D Group 3 encoding
    • -4 โ€” Group 4 encoding
    • -A โ€” beginning of line is aligned on a byte boundary
    • -P โ€” beginning of line is not aligned on a byte boundary
    • -X n โ€” the image width in pixels
    • -W โ€” encoding uses 1 for black and 0 for white
    • -B โ€” encoding uses 0 for black and 1 for white
    • -M โ€” input data fills from most significant bit to least significant bit
  • -all โ€” write JPEG, JPEG2000, JBIG2, and CCITT images in their native format ๐Ÿซง CMYK files come out as TIFF, and all other images come out as PNG. this is the same as specifying -png -tiff -j -jp2 -jbig2 -ccitt ๐Ÿ‘‘
  • -list โ€” no image writing here, bestie! instead it lists each image along with its info ๐Ÿ“‹ don't give an image-root with this one ๐Ÿ™ˆ

okay so here's what gets listed for each image:

  • page โ€” the page number containing the image
  • num โ€” the image number
  • type โ€” the image type:
    • image โ€” an opaque image
    • mask โ€” a monochrome mask image
    • smask โ€” a soft-mask image
    • stencil โ€” a monochrome mask image used for painting a color or pattern
โš ๏ธ transparency in images is represented in PDF with a separate image for the image and the mask/smask. the mask/smask used as part of a transparent image always comes right after the image in the list ๐Ÿ’€
  • width โ€” image width (in pixels)
  • height โ€” image height (in pixels)
๐Ÿ“ the width/height is the size of the embedded image, NOT the size it'll be rendered at ๐Ÿซถ
  • color โ€” image color space:
    • gray โ€” Gray
    • rgb โ€” RGB
    • cmyk โ€” CMYK
    • lab โ€” L*a*b
    • icc โ€” ICC Based
    • index โ€” Indexed Color
    • sep โ€” Separation
    • devn โ€” DeviceN
  • comp โ€” number of color components
  • bpc โ€” bits per component
  • enc โ€” encoding:
    • image โ€” raster image (may be Flate or LZW compressed, but doesn't use an image encoding)
    • jpeg โ€” Joint Photographic Experts Group
    • jp2 โ€” JPEG2000
    • jbig2 โ€” Joint Bi-Level Image Experts Group
    • ccitt โ€” CCITT Group 3 or Group 4 Fax
  • interp โ€” "yes" if interpolation is to be performed when scaling up the image
  • object ID โ€” the image dictionary object ID (number and generation)
  • x-ppi โ€” the horizontal resolution of the image (in pixels per inch) when rendered on the PDF page
  • y-ppi โ€” the vertical resolution of the image (in pixels per inch) when rendered on the PDF page
  • size โ€” the size of the embedded image in the PDF file. the suffixes are B bytes, K kilobytes, M megabytes, and G gigabytes ๐Ÿ“ฆ
  • ratio โ€” the compression ratio of the embedded image ๐Ÿ—œ๏ธ
  • -opw password โ€” give the owner password for the PDF. doing this bypasses all security restrictions ๐Ÿ”“ (use responsibly, bestie ๐Ÿซถ)
  • -upw password โ€” give the user password for the PDF ๐Ÿ”‘
  • -p โ€” include page numbers in the output file names ๐Ÿ”ข
  • -print-filenames โ€” print the image filenames to stdout ๐Ÿ–จ๏ธ
  • -q โ€” shh, don't print any messages or errors ๐Ÿคซ
  • -v โ€” print copyright and version info ๐ŸŽŸ๏ธ
  • -h โ€” print usage info. (-help and --help are the same thing ๐Ÿ’โ€โ™€๏ธ)

๐Ÿ’€ EXIT CODES

the Xpdf tools use these exit codes, periodt:

  • 0 โ€” no error โœ…
  • 1 โ€” error opening a PDF file ๐Ÿฅ€
  • 2 โ€” error opening an output file ๐Ÿฅ€
  • 3 โ€” error related to PDF permissions ๐Ÿ”’
  • 99 โ€” other error ๐Ÿ˜ญ

๐Ÿฉท AUTHOR

the pdfimages software and documentation are copyright 1998-2011 Glyph & Cog, LLC ๐ŸŒˆ

๐Ÿงš SEE ALSO

pdfdetach(1), pdffonts(1), pdfinfo(1), pdftocairo(1), pdftohtml(1), pdftoppm(1), pdftops(1), pdftotext(1), pdfseparate(1), pdfsig(1), pdfunite(1) ๐Ÿ“š


okay bestie that's the whole tea ๐Ÿซถ this page was last updated 15 August 2011, and it's all about pdfimages(1) ๐Ÿ’– stay iconic, and go extract some images ๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from