From 273a6cf2f23e1dc2bb439b1e505624017bf537d1 Mon Sep 17 00:00:00 2001 From: Castro0o Date: Thu, 20 Feb 2020 13:25:56 +0100 Subject: [PATCH 1/3] my changes --- helper-upload_imgs_dir.sh | 5 +++-- pdf2jpg.sh | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100755 pdf2jpg.sh diff --git a/helper-upload_imgs_dir.sh b/helper-upload_imgs_dir.sh index 138539f..4f7b51b 100755 --- a/helper-upload_imgs_dir.sh +++ b/helper-upload_imgs_dir.sh @@ -7,8 +7,9 @@ python3 upload_imgs_dir.py \ --org 'Communist Party of the Philippines' \ --format 'Bulletin' \ --topic 'Communism, Armed Struggle' \ ---dir '/full/path/to/2020_bantayog/Folder name' \ -# --dry +--dir '/home/andre/Documents/xpub/2019_2021/SI11/2020_bantayog/Ang Bayan, December 1984, Sc CJ Cortez, 2020Jan17' \ +--dry + # Note: # * Add this values to you upload specific upload. diff --git a/pdf2jpg.sh b/pdf2jpg.sh new file mode 100755 index 0000000..0382f10 --- /dev/null +++ b/pdf2jpg.sh @@ -0,0 +1,8 @@ +#!/bin/sh +PDF="$1" +echo "$PDF" +DIR=`echo "$PDF" | sed s/\.pdf//` +echo "$DIR" +mkdir "$DIR" +convert -quality 100 -density 300 $1 "$DIR/"%02d.jpg + From 7d95af73d50d10c64e05869e3b0272174bf4ac6c Mon Sep 17 00:00:00 2001 From: Castro0o Date: Thu, 20 Feb 2020 13:49:14 +0100 Subject: [PATCH 2/3] pdf2jpg.sh ready --- README.md | 11 +++++++++++ pdf2jpg.sh | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dc629e5..5a2fe60 100644 --- a/README.md +++ b/README.md @@ -84,5 +84,16 @@ Get Help: `python3 upload_imgs_dir.py --help` **Edit and run via** `.helper-upload_imgs_dir.sh` + +# Convert PDFs to folder of JPGs with pdf2jpg.sh +By either: +* running it from this folder and using absolute path to PDF +`./pdf2jpg.sh "/full/path/to/2020_bantayog/PDFname.pdf"` + +* copying pdf2jpg.sh to 2020_bantayog/ and running with relative path to PDF +`./pdf2jpg.sh "PDFname.pdf"` + +It is + to convert pdfs to jpgs: convert -quality 100 -density 300 [name-of-pdf] %02d.jpg diff --git a/pdf2jpg.sh b/pdf2jpg.sh index 0382f10..b0b1866 100755 --- a/pdf2jpg.sh +++ b/pdf2jpg.sh @@ -4,5 +4,6 @@ echo "$PDF" DIR=`echo "$PDF" | sed s/\.pdf//` echo "$DIR" mkdir "$DIR" -convert -quality 100 -density 300 $1 "$DIR/"%02d.jpg - +echo "Starting convertion ..." +convert -quality 100 -density 300 "$PDF" "$DIR/"%02d.jpg +echo "PDF converted thanks to Damla aka Imagemagick ninja" From ed592989785b6f2d089682d24a143457f8b79474 Mon Sep 17 00:00:00 2001 From: Castro0o Date: Thu, 20 Feb 2020 14:03:27 +0100 Subject: [PATCH 3/3] undid changes to helper-upload-imgs-dir --- helper-upload_imgs_dir.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/helper-upload_imgs_dir.sh b/helper-upload_imgs_dir.sh index 4f7b51b..138539f 100755 --- a/helper-upload_imgs_dir.sh +++ b/helper-upload_imgs_dir.sh @@ -7,9 +7,8 @@ python3 upload_imgs_dir.py \ --org 'Communist Party of the Philippines' \ --format 'Bulletin' \ --topic 'Communism, Armed Struggle' \ ---dir '/home/andre/Documents/xpub/2019_2021/SI11/2020_bantayog/Ang Bayan, December 1984, Sc CJ Cortez, 2020Jan17' \ ---dry - +--dir '/full/path/to/2020_bantayog/Folder name' \ +# --dry # Note: # * Add this values to you upload specific upload.