gs -dNOPAUSE -sDEVICE=jpeg -dFirstPage=1 -dLastPage=5 -sOutputFile=out/output%03d.jpg -dJPEGQ=90 -r200 -q input.pdf -c quit