Created
March 11, 2020 00:04
-
-
Save ziadoz/2b1edc86c51bcc6aa5ac6005f56f5f84 to your computer and use it in GitHub Desktop.
Extract Images From PDF / Build PDF From Images / Remove PDF White Margins (Ubuntu)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Extract images from a PDF: https://askubuntu.com/questions/117143/command-line-tool-to-bulk-extract-images-from-a-pdf | |
sudo apt-get install poppler-utils | |
pdfimages -all input.pdf images/image | |
# Build PDF from images: https://stackoverflow.com/questions/8955425/how-can-i-convert-a-series-of-images-to-a-pdf-from-the-command-line-on-linux | |
sudo apt install img2pdf | |
img2pdf --output d.pdf images/image*.jpg | |
# Extracting the images from a PDF and then rebuilding it removes white margins surrounding images. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment