User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
imagemagick [2022/02/07 13:29] – external edit 127.0.0.1imagemagick [2023/12/31 16:19] (current) ssm2017
Line 44: Line 44:
 <sxh bash> <sxh bash>
 convert *.jpg mypdffile.pdf convert *.jpg mypdffile.pdf
 +</sxh>
 +
 +==== pdf to images ====
 +<sxh bash>
 +#!/bin/bash
 +
 +# Script to convert PDF file to JPG images
 +#
 +# Dependencies:
 +# * pdftk
 +# * imagemagick
 +
 +PDF=$1
 +
 +echo "Processing $PDF"
 +DIR=`basename "$1" .pdf`
 +
 +mkdir "$DIR"
 +
 +echo '  Splitting PDF file to pages...'
 +pdftk "$PDF" burst output "$DIR"/%04d.pdf
 +pdftk "$PDF" dump_data output "$DIR"/metadata.txt
 +
 +echo '  Converting pages to JPEG files...'
 +for i in "$DIR"/*.pdf; do
 +  convert -colorspace RGB -interlace none -density 300x300 -quality 100 "$i" "$DIR"/`basename "$i" .pdf`.jpg
 +done
 +
 +echo 'All done'
 </sxh> </sxh>
  
 {{tag>imagemagick pdf}} {{tag>imagemagick pdf}}

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information