Created
September 6, 2023 12:46
-
-
Save cfbastarz/a1b926784b91adcc02f4605210c533ea to your computer and use it in GitHub Desktop.
Create a pdf file (chop, rotate and convert png to pdf)
This file contains hidden or 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
# Chop the figures (in my case, figures were in landscape mode) | |
for i in $(ls *.png); do j=$(echo $i | sed "s,.png,-chop.png,g"); convert $i -gravity South -chop 0x10 -gravity North -chop 0x50 -gravity East -chop 296x0 -gravity West -chop 296x0 $j; done | |
# Rotate the figures 90 degrees (clockwise) | |
for i in $(ls *-chop.png); do j=$(echo $i | sed "s,-chop.png,-chop-rot90.png,g"); convert $i -rotate 90 $j; done | |
# Convert all figures to PDF | |
for i in $(ls *-chop-rot90.png); do j=$(echo $i | sed "s,-chop-rot90.png,.pdf,g"); convert $i $j; done | |
# Unite all PDF (21) files into one | |
pdfunite $(echo {1..21}.pdf) artigo.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment