Created
December 14, 2023 08:32
-
-
Save erral/4eb23da94973207e781dda45b118f267 to your computer and use it in GitHub Desktop.
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 python | |
# -*- coding: utf-8 -*- | |
""" install pdftoppm first (use your package manager) """ | |
import os | |
def main(start="."): | |
for dirpath, dirnames, filenames in os.walk(start): | |
for filename in filenames: | |
if filename.endswith('pdf') and not filename.startswith('.') and f'{filename}.jpg' not in filenames: | |
os.system(f'pdftoppm -jpeg -f 1 -l 1 "{dirpath}/{filename}" > "{dirpath}/{filename}.jpg"') | |
print(f"Done {dirpath}/{filename}") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment